How do I create a versioned jar file using Ant?
Author: Deron Eriksson
Description: This tutorial describes how to create a versioned jar file using Ant's buildnumber task
Tutorial created using:
Windows XP || JDK 1.5.0_09 || Eclipse Web Tools Platform 1.5.1
(Continued from page 1) If we execute 'build-jar-version', we see the following result in the console: Buildfile: C:\projects\workspace\team-cakes-utilities\build.xml build-jar-version: clean: [delete] Deleting directory C:\projects\workspace\team-cakes-utilities\bin [mkdir] Created dir: C:\projects\workspace\team-cakes-utilities\bin copy-non-java-files: compile-jar-classes: [javac] Compiling 2 source files to C:\projects\workspace\team-cakes-utilities\bin [mkdir] Created dir: C:\projects\workspace\team-cakes-utilities\build-version jar-version: [jar] Building jar: C:\projects\workspace\team-cakes-utilities\build-version\team-cakes-utilities-1.0.jar BUILD SUCCESSFUL Total time: 1 second In the Navigator view, we can see that the build-version directory was created, and the team-cakes-utilities-1.0.jar file was placed in the directory. The build.number file was created in the project's root directory. ![]() If we execute 'build-jar-version' again, we see that team-cakes-utilities-1.1.jar is created and put in the build-version dirctory. ![]() Of course, it's probably a good idea to commit the build.number file to your code repository (such as CVSW) so that the correct version number is saved. (Continued on page 3) Related Tutorials: |