Skip to content

Instantly share code, notes, and snippets.

@aembleton
Last active December 25, 2015 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aembleton/6887807 to your computer and use it in GitHub Desktop.
Save aembleton/6887807 to your computer and use it in GitHub Desktop.
Builds a jar
#Sat, 12 Oct 2013 23:12:10 +0100
major=0
minor=1
build=3
<project name="ScrapeRequest" basedir="." default="jar">
<property name="build" value="build"/>
<property file="build.info" prefix="info"/>
<target name="clean">
<delete dir="${build}"/>
</target>
<target name="init" depends="clean">
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init">
<!-- Compile the java code -->
<javac srcdir="src" destdir="${build}" />
</target>
<target name="incrementBuild">
<propertyfile file="build.info">
<entry key="build" operation="+" value="1" type="int"/>
</propertyfile>
</target>
<target name="buildJar" depends="compile,incrementBuild">
<!-- Build the jar file -->
<jar basedir="${build}" destfile="ScrapeRequest-${info.major}.${info.minor}.${info.build}.jar"/>
</target>
<target name="jar" depends="buildJar">
<!-- jar has been built, now just remove the build directory so that it doesn't pollute the dev environment -->
<delete dir="${build}"/>
</target>
</project>
@aembleton
Copy link
Author

Without the type="int", a 1 gets appended to the end of the value, so you end up with 01111... etc. The int forces it to actually increment the value as a number.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment