2011/12/21 - Jakarta has been retired.

For more information, please explore the Attic.



The Java(tm) Product Versioning Specification allows users to identify the exact version information of a package within a JAR. This is particularly useful when users have a number of packages, with version interdependences, from various distributions.

These four simple steps use Ant to maintain and insert the versioning information, so all JARs shipped are correctly versioned. Note: This is just one method, and in future releases Ant may have built in mechanisms for this task.

Step 1: Manually create a template manifest file.

Java versioning is implemented by attributes set within the manifest of the JAR.

See Javasoft's documentation on: JAR Manifest Format

Manifest-version: 1.0

Name: org/apache/{Apache Package}/
Implementation-Title: {Apache Package}
Implementation-Version: @version@
Implementation-Vendor:  The Apache Software Foundation
Implementation-Vendor-Id: org.apache

Save this with your build.xml as a file called manifest.template.

Note: The {Apache Package} ought be manually replaced by the package name, e.g. "log4j" or "Axis"
Note: The @version@ is a specific keyword used later in Ant filtering, and will be dynamically updated.

Step 2: Maintain the version in your Ant build script

Set and maintain the ${version} property.

<property name="version" value="1-1-1" />

Step 3: Create the manifest, filtering the version

This replaces @version@ in manifest.template with 1-1-1 in manifest.mf.

<target name="manifest">
    <filter token="version" value="${version}" /> 
    <copy    file="manifest.template"
        filtering="true" /> 

Step 4: Create your JAR, setting the manifest attribute

This sets the META-INF/manifest.mf in the JAR file.

<target name="distribution" depends="... manifest ...">
    <jar jarfile=...

Sample Files: manifest.template, build.xml

About Jakarta

About Apache

Retired Subprojects