ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conor MacNeill" <>
Subject RE: How do you version jar files?
Date Thu, 15 Nov 2001 22:47:54 GMT

There are a number of ways to version jars depending on your taste.

1. Name the jar with the version as part of the name. This is the way Ant's
own jars are distributed.

2. Add a properties file as a resource to the jar which can then be loaded
by your code as a resource. Ant also does this.

3. Munge a version class as you suggested

4. Add a manifest entry to the jar.

I like 3 the least since I prefer, generally, not to modify the source
coming out of the respository.

I would go with 1 in combination with either 2 or 4. Have a look at Ant'2
build file for an example of 2 in operation.

For option 4, you can use an inline manifest

    <jar file="my.jar">
        <attribute name="MyJarVersion" value="${version}"/>

The version property would best be managed by a <propertyfile> task if you
want it to update with every build, otherwise manage it manually by editing
the build file.


> -----Original Message-----
> From: Scott Moore []
> Sent: Friday, 16 November 2001 6:44 AM
> To: Ant User (E-mail)
> Subject: How do you version jar files?
> Hi All,
> I would like to solicit people's opinion's on the best way to version our
> Jar files so our deployment people can easily find out the
> version and build
> number.  I've seen some jar files include a Version class that when run,
> spits out the version number to stdout.  Is this the best way do to that?
> If so, I would like to have Ant increment and update the build
> number in the
> code.  Looking thru the Ant docs, I see there is a
> file search
> and replace text capability, but I didn't see a way to increment a build
> number.  Do I need to write a new Ant task to do this operation?
> Thanks for any input!
> Scott

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message