How do I version a product of a build?

Erik Hatcher

There is no single answer, but here are some thoughts:

  • Use <propertyfile> and a properties file to keep an incrementing value
  • Use the appropriate source code management tasks (i.e. <cvs>) to checkout and check back in the properties file used to track version numbers
  • Load the properties file in using <property file="..."/> and use the version property for the appropriate directory names, file names, and manifest entries.
  • Do not name JAR files with the version number in its name if you can avoid it - name the distribution directory with the version number instead. It makes using your JAR file in automated environments much nicer to deal with a constant name for the JAR file when upgrading.

I anticipate this entry to generate comments and criticism - and I will update the FAQ entry as needed to reflect improved ideas on this topic.