четверг, 30 января 2014 г.

Deploy artifacts from Ivy to Artifactory

After some time struggling with deploying jar files to Apache Archiva I decided to throw it out and replace with Artifactory oss version.
The installation of Artifactory is simple - just drop the war file into Tomcat webapp.

What is important for me is that Artifactory supports deployment of artifacts with Ivy.


To deploy to Artifactory you have do describe the repository in ivysettings.xml like this:
<ivysettings>
    <settings defaultResolver="artifactory" />
<resolvers>
    <url name="artifactory">
        <ivy pattern="http://localhost:12345/artifactory/libs-snapshot-local/[organization]/[module]/[revision]/ivy-[revision].xml" />
        <artifact pattern="http://localhost:12345/artifactory/libs-snapshot-local/[organization]/[module]/[revision]/[artifact].[ext]"/>
    </url>
</resolvers>
    </ivysettings>


In ivy file you import configuration and set the credentials:
<ivy:settings file="./ivysettings.xml" id="set">
         <credentials host="localhost" realm="Artifactory Realm" username="admin" passwd="password" />
</ivy:settings>


Use publish task to publish your jar file:
<ivy:resolve refresh="true" showprogress="true"  />
<ivy:publish  settingsref="set" artifactspattern="${jar.dir}/[artifact].[ext]" resolver="artifactory" pubdate="${now}" forcedeliver="true"   overwrite="true"/>


Call publish task and look at how your artifact deploys to Artifactory.

Комментариев нет:

Отправить комментарий