Apache Ivy & Settings File
I'm writing my first Ivy configuration for a new Java project and am trying to hook my ivy-settings.xml file up to my buildscript.
I've followed all the tutorials and have correctly added the xmlns:ivy="antlib:org.apache.ivy.ant"
namespace to my build.xml file. So far I've tried running my resolve and cleancache targets, which run ivy:resolve
and ivy:cleancache
respectively, and all seems to be working (Ant can find Ivy).
However...when I run ivy:resolve, it defaults to go right to the public repo. Since my resolvers are written to look in my SVN root, I have to conclude that Ivy does not see my ivy-settings.xml file and is going to the public repos by default.
I am purposely keeping my ivy-settings.xml file as a separate project in source control because it will be used by all my projects.
So开发者_如何学C my question:
How do I instruct the Ant buildscipt to look for a checked-out version of ivy-settings.xml somewhere else in my file system, not just sitting there locally in the same directory as build.xml?
Change the settings file name to:
ivysettings.xml
If you want to change this default name and location (same directory as build file) use the "settings" task
Update
This is how I ensure that the settings file is loaded before invoking the ivy resolve of cleancache tasks. Create a target called init that is declared as a dependency
<target name="init">
<ivy:settings file="../../ivysettings.xml"/>
</target>
<target name="resolve" depends="init">
<ivy:resolve/>
</target>
<target name="clean" description="Cleanup build directory">
<delete dir="${build.dir}"/>
</target>
<target name="clean-all" depends="init,clean" description="Clean and purge caches">
<!-- Purge the ivy cache -->
<ivy:cleancache/>
</target>
精彩评论