ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <>
Subject Re: How do you version jar files?
Date Thu, 15 Nov 2001 23:19:21 GMT
On Fri, 16 Nov 2001 09:47, Conor MacNeill wrote:
> Scott,
> 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 use either 3 or 4 combined with 1. The main reason is that I have 
seen a few projects who used 2 and had bug of forgetting to include property 
file in build which made it difficult to report a bug against that version.

(3) has similar problems to (2) but these problems seem to occur less often 
than those in (2). See the jakarta-avalon-phoenix/build.xml file for an 
example of adding constants into java class.

4 while the best is only viable in some cases because not all classloaders 
will construct the proper Package objects which you can get version info from.

(1) is too easy for users to break.

In a few of my projects I actually do 1(for ease of use), 3 (for programatic 
access) and 4 (for compatability with Optional Package specification in 


Fools ignore complexity.  Pragmatists suffer it.
Some can avoid it.  Geniuses remove it.
-- Perlis's Programming Proverb #58, SIGPLAN Notices, Sept. 1982

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

View raw message