Wednesday, 7 October 2009

Hosting a custom maven archetype in Artifactory

Today we needed to set up a an in-house Maven 2 repository. The product we chose for this task is Artifactory from JFrog. Setting up this product will maybe be a separate blog post sometime, but for now the focus of this post will be on getting Artifactory to serve a custom Maven archetype.

After creating your archetype you'll first need to install it to your new Maven repository. This can easily be done using the Artifactory web interface. Once this is done you'll need to create an archetype-catalog.xml file that describes your new archetype using these rules:




your.group.id
your.artifact.id
1.0
http://your.artifactory.server:8081/artifactory/libs-releases/local



Once this is done you'll need to get Artifactory to serve this file. As there is no direct GUI support for this in the web interface, we'll need to use a workaround for this:

curl -u admin:password -f -T /path/to/archetype-catalog.xml -X PUT "http://your.artifactory.server:8081/artifactory/libs-releases-local/archetype-catalog.xml"

Once this is done you'll be able to define a remote archetype catalog with this URL:

http://your.artifactory.server:8081/artifactory/libs-releases-local

You can also easily use it in combination with the m2eclipse plugin:



1 comment:

  1. Thanks for your guide.
    Some errors I had to correct:
    it is and not and
    Also is should be:
    http://your.artifactory.server:8081/artifactory/libs-releases-local/

    ReplyDelete