Typically, to make Ivy tasks available to an Ant build, you need to:
ivy.jar
to ${ANT_HOME}/lib
.xmlns:ivy="antlib:org.apache.ivy.ant"
declaration to your build.xml's <project>
element.<taskdef>
declaration inside build.xml that reference's the ivy.jar
's antlib.xml
file where all other tasks are defined.I'd like to accomplish all of the above except the first step (adding ivy.jar
to ${ANT_HOME}/lib
). I'd like to have ivy.jar
living somewhere inside my project, say, at lib/buildtime/ivy.jar
, and somehow reference lib/buildtime/ivy.jar
as where Ivy is located.
Is this possible? If so, how? If not, why? Thanks in advance!
The taskdef (step 3) is not required if the ivy jar is located in a standard ANT library directory.
I would recommend including a special "bootstrap" target that will install the ivy jar. Once this is done all other dependencies (including 3rd party ANT tasks) can be downloaded by ivy as a build dependency.
Here is my default build file that demonstrates the concept:
<project name="demo" default="resolve" xmlns:ivy="antlib:org.apache.ivy.ant">
<target name="bootstrap" description="Install ivy">
<mkdir dir="${user.home}/.ant/lib"/>
<get dest="${user.home}/.ant/lib/ivy.jar" src="http://search.maven.org/remotecontent?filepath=org/apache/ivy/ivy/2.3.0/ivy-2.3.0.jar"/>
</target>
<target name="resolve" description="Use ivy to resolve classpaths">
<ivy:resolve/>
<ivy:report todir='build/ivy-reports' graph='false' xml='false'/>
<ivy:cachepath pathid="compile.path" conf="compile"/>
<ivy:cachepath pathid="test.path" conf="test"/>
</target>
<target name="clean" description="Cleanup build files">
<delete dir="build"/>
</target>
<target name="clean-all" depends="clean" description="Additionally purge ivy cache">
<ivy:cleancache/>
</target>
</project>
Notes:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With