Reputation: 1198
I've managed to cobble together a CI system using Jenkins with an Ant build system that uploads the resultant .jar to Artifactory using the Artifactory plugin.
I now need another build which is also Ant to retrieve the latest jar from artifactory using a target in the build.xml.
I can find lots of articles about how to upload but few about resolving.
The closest I have found is http://wiki.jfrog.org/confluence/display/RTF/Working+with+Ivy but this mainly deals with uploading in the vital areas, the screenshots are out of data (or my Artifactory is and I can't update it) and deals with getting ivy or pom files.
I'm an Ant/ivy noob so any pointers how to put the target together would be greatly appreciated.
Upvotes: 1
Views: 9690
Reputation: 18704
I assume that you already installed ivy.
You need to define a resolver to artifactory in a file called ivysettings.xml (put it in the root folder, beside the build.xml):
<ivysettings>
<resolvers>
<ibiblio name="artifactory" m2compatible="true" root="http://localhost:8080/artifactory/libs-releases"/>
</resolvers>
</ivysettings>
In your build.xml I'd use an inline retrieve (so that you won't have to write an ivy.xml):
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="myName">
...
<target name="retrieve" description="retrieve">
<ivy:settings /> <!-- needed so that ivysettings.xml is used-->
<ivy:retrieve organisation="foo" module="bar" inline="true" pattern="lib/[artifact].[ext]"/>
</target>
</project>
This will download the artifact into the lib dir. For organisation and module take the values you find in artifactory.
In this image from the link you gave, you can see how to get organisation and artifact from artifactory. It will offer you a dependency declaration box. Just check ivy and take the values from there.
Upvotes: 4