Skip to content

Instantly share code, notes, and snippets.

@andirady
Created April 24, 2020 14:40
Show Gist options
  • Save andirady/bd64e30f3da3f02e1ba84d1b029b2549 to your computer and use it in GitHub Desktop.
Save andirady/bd64e30f3da3f02e1ba84d1b029b2549 to your computer and use it in GitHub Desktop.
Use ant+ivy to build java project without having to perform dependency resolution on every compilation.
<project name="test" xmlns:ivy="antlib:org.apache.ivy.ant">
<property name="src.dir" value="src/main/java" />
<property name="build.dir" value="build" />
<property name="classes.dir" value="build/main/classes" />
<target name="resolve">
<ivy:cachepath pathid="lib.path.id" />
<echo file="classpath.properties">compile.classpath=${toString:lib.path.id}</echo>
</target>
<target name="compileJava">
<property file="classpath.properties" />
<mkdir dir="${classes.dir}"/>
<javac srcdir="${src.dir}" destdir="${classes.dir}" classpath="${compile.classpath}"/>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment