java - ANT : What is the simplest way to add version number to built jar? -
<?xml version="1.0" encoding="utf-8"?> <project name="myplugin" default="all"> <target name="artifact.myplugin:jar" depends="init.artifacts, compile.module.myplugin" description="build 'myplugin:jar' artifact"> <mkdir dir="${artifact.output.myplugin:jar}" /> <jar destfile="${temp.jar.path.myplugin.jar}" duplicate="preserve" filesetmanifest="mergewithoutmain"> <zipfileset file="${basedir}/meta-inf/manifest.mf" prefix="meta-inf" /> <zipfileset dir="${myplugin.output.dir}" /> </jar> <!--how add together version number reflects projects version --> <copy file="${temp.jar.path.myplugin.jar}" tofile="${artifact.output.myplugin:jar}/plugin.company.jar" /> </target>
what typcial way people this?
example (pulled above)
<copy file="${temp.jar.path.myplugin.jar}" tofile="${artifact.output.myplugin:jar}/plugin.company{version}.jar" />
the simplest solution utilize ant buildnumber task.
<project name="myplugin" default="all"> <property name="version" value="1.0"/> <target... <buildnumber/> <jar destfile="/path/to/jar/myjar-${version}.${build.number}.jar" ... ... </jar> </target> </project>
each build generate unique release number:
myjar-1.0.0 myjar-1.0.1 myjar-1.0.2 .. java ant
No comments:
Post a Comment