Created
June 8, 2011 14:01
-
-
Save butlermh/1014468 to your computer and use it in GitHub Desktop.
Using configurations in Ant
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
<!-- resolve the job and test dependencies to different directories --> | |
<target name="resolve" depends="clean-lib" description="--> resolve and retrieve dependencies with ivy"> | |
<mkdir dir="${job.lib.dir}"/> <!-- not usually necessary, ivy creates the directory IF there are dependencies --> | |
<mkdir dir="${test.lib.dir}"/> | |
<ivy:resolve file="${ivy.file}" transitive="true"/> | |
<ivy:retrieve pattern="${job.lib.dir}/[artifact]-[revision].[ext]" conf="job" /> | |
<ivy:retrieve pattern="${test.lib.dir}/[artifact]-[revision].[ext]" conf="test" /> | |
</target> | |
<!-- create paths for job and test | |
<path id="lib.path.id"> | |
<fileset dir="${job.lib.dir}" /> | |
</path> | |
<path id="test.path.id"> | |
<pathelement location="${test.classes.dir}" /> | |
<pathelement location="${classes.dir}"/> | |
<pathelement location="${basedir}/src/test/conf"/> | |
<fileset dir="${test.lib.dir}"/> | |
<path refid="lib.path.id"/> | |
</path> | |
<!-- use the appropriate paths for compilation --> | |
<target name="compile" depends="resolve" description="--> compile the project"> | |
<mkdir dir="${classes.dir}" /> | |
<javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="lib.path.id" debug="true" includeantruntime="false"/> | |
</target> | |
<target name="compile-test" depends="compile" description="--> compile the test classes"> | |
<mkdir dir="${test.classes.dir}" /> | |
<javac srcdir="${test.src.dir}" destdir="${test.classes.dir}" classpathref="test.path.id" debug="true" /> | |
</target> | |
<!-- only include job dependencies in the final .job file --> | |
<target name="job" depends="jar" description="--> generate a job file for this project"> | |
<jar destfile="${job.file}"> | |
<zipfileset dir="${job.lib.dir}" prefix="lib" | |
includes="**/*.jar" excludes="hadoop-*.jar"/> | |
</jar> | |
</target> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment