Reputation: 620
I have a super wonderful task that populates a path id...
<ivy:cachepath organisation="XXXX" module="ZZZZ" revision="0.2.4-SNAPSHOT" inline="true" pathid="mypath"/>
Without writing complex Java code is there a way to convert "mypath" into something the ant task could accept? I'd really like to specifically delete these cache files (I"m working around a bug in Ivy that it doesn't actually re-fetch snaphots).
Upvotes: 0
Views: 471
Reputation: 107080
This worked for me:
<path id="test">
<pathelement path="${basedir}/foo"/>
<pathelement path="${basedir}/bar"/>
</path>
<delete>
<path refid="test"/>
</delete>
I didn't use <ivy:cachepath/>
, but I did create a Path ID and was able to delete the individual elements using the Path as an refid.
Upvotes: 1
Reputation: 77991
Don't understand what you're trying to do. Most ANT tasks accept classpath references, which is what the ivy cachpath task creates. Secondly deleting files from the ivy cache seems suspect... Sort of defeats the purpose of using ivy :-)
But you asked, so I'd recommend using an ivy retrieve instead as follows:
<ivy:retrieve pattern="${build.dir}/lib/[artifact](-[classifier]).[ext]">
<dependency org="org.slf4j" name="slf4j-api" rev="1.7.5" conf="default"/>
<dependency org="org.slf4j" name="slf4j-simple" rev="1.7.5" conf="default"/>
</ivy:retrieve>
<path id="mypath">
<fileset dir="${build.dir}/lib" includes="*.jar"/>
</path>
Note:
I suspect your ivy "bug" fetching snapshots is actually an issue with your ivy settings file. Only ibilio resolvers understand Maven's internal mechanism for tracking snapshots. For more information read about the "m2compatible" and "useMavenMeta" options.
Are you publishing snapshots from ivy into a Maven repository like Nexus?
Yeah... That's a known issue. Possible work-arounds to consider are here:
My advise would be to avoid snapshot releases unless you need to work with Maven projects. ivy has a wonderful buildnumber task that makes generating unique builds a snap. Opinions differ.
Upvotes: 0