Created
May 11, 2016 14:37
-
-
Save ricston-git/bcc827aa554af8ddad02dfcf51d35e5a to your computer and use it in GitHub Desktop.
Gist for "Java Build Tools, JavaScript Package Managers and Task Runners (Part 1)" blog-post.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project name="JavaBuildToolsExample" default="jar" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant"> | |
<!-- Ant properties: Sub-directories are resolved with respect to the "basedir" attribute above. --> | |
<property name="src.dir" value="src"/> | |
<!-- Renamed the build directory as "/build-ant" so that it is distinguishable from "/build", created by Gradle. --> | |
<property name="build.dir" value="build-ant"/> | |
<property name="classes.dir" value="${build.dir}/classes"/> | |
<property name="jar.dir" value="${build.dir}/jar"/> | |
<property name="lib.dir" value="lib" /> | |
<!-- "fileset" attribute defines a group of files, in this case, under the "lib" directory. --> | |
<path id="lib.path.id"> | |
<fileset dir="${lib.dir}" /> | |
</path> | |
<target name="clean"> | |
<delete dir="${build.dir}"/> | |
</target> | |
<!-- Retrieves dependencies using default parameters. This usually retrieves all the dependencies of the last resolve call to the "lib" directory. --> | |
<target name="resolve"> | |
<ivy:retrieve /> | |
</target> | |
<!-- The "compile" target depends on the "resolve" target above. --> | |
<target name="compile" depends="resolve"> | |
<mkdir dir="${classes.dir}"/> | |
<javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="lib.path.id"/> | |
</target> | |
<!-- The "jar" target depends on the "compile" target, which in turn depends on "resolve" --> | |
<target name="jar" depends="compile"> | |
<mkdir dir="${jar.dir}"/> | |
<jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}"/> | |
</target> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment