I’d like to know if “Ant-based versioning” is possible, or something like it. Here’s what I mean:
A common naming convention for JARs is something like MyJar-1.0.14.jar, where MyJar is the primary name of the JAR file, and the -1.0.14 represents the version number.
In my Ant buildscript, I’m going to have a task dist that will look something like:
<target name="dist" depends="compile">
<jar destfile="${dist.dir}/MyJar.jar">
<!-- All the filesets to JAR up -->
</jar>
</target>
My question is: does Ant support anything that would automatically update the JARs name with the correct version number per some external scheme? Something so that the Ant target might actually look like:
<target name="dist" depends="compile">
<jar destfile="${dist.dir}/MyJar-[revision].jar">
<!-- All the filesets to JAR up -->
</jar>
</target>
Where [revision] is the build/revision number according to some internally-defined revision scheme (perhaps defined in some other external file)?
If so, then if I am to understand my situation, then I am stuck modifying the build.xml file every time I want to JAR-up a new version of my distribution? Yes? No?
Not aware of any ant task to auto-increment the number, but you should defined the revision as a property in a build.properties file which you’ll import. The property file will contain a default value
in the ant build.xml file
To update the property at build time you just call the ant target with the -D value set
this avoids the need to update any file at release time.