Currently I have a Maven2 project that builds a JAR when you run:
mvn clean package
I need to now tweak the pom.xml
to publish this JAR (myapp.jar
) to an Artifactory server running at:
http://myartifactory/artifactory/simple/myorg/myapp/0.1
I tried adding a <repositories>
element to my pom.xml
but nothing is being published with this config:
<repositories>
<repository>
<id>myartifactory</id>
<url>http://myartifactory/artifactory/simple/</url>
</repository>
</repositories>
Any ideas as to how I could get publishing to work? For simplicity's sake, pretend that this Artifactory repo is authenticated to accept publishes/writes from a user with a username=foo
and password=bar
.
You have two options (please note that the later is the recommended one):
Add DistributionManagement
part to your pom and server
part to your settings.xml
Distribution Management
snippet and paste it in your pom.xml
:
server
tag from Maven Settings
panel:
This one you paste in your settings.xml
. Don't forget to replace the ${server-id} with the real server id (the one you have in Distribution Management now).mvn deploy
and enjoy.Working with Maven Artifactory Plugin:
<plugin>
part as described in the wiki to your pom.xml
. It includes both the target repository and the credentials (please use external credentials source, like environment variables or system properties).mvn deploy
and enjoy not only the deployment to Artifactory, but also additional features as described below.Additional features of Artifactory Maven Plugin (on top of regular Maven deployment):