Tuesday, November 25, 2014

Configure Maven to Deploy on Nexus

Removed
Today we will give the tip to deploy your war on Nexus.



So, in order to be able to deploy you war on a remote Repository using Maven, you need to add some configuration to your pom.xml. Here the lines to add :


<distributionManagement>
 <repository>
  <id>releases</id>
  <name>Releases</name>
  <url>http://NEXUS_ADDRESS:8081/nexus/content/repositories/releases/</url>
 </repository>
 <snapshotRepository>
  <id>snapshots</id>
  <name>Snapshots</name>
  <url>http://NEXUS_ADDRESS:8081/nexus/content/repositories/snapshots/</url>
 </snapshotRepository>
</distributionManagement>

You need to make sure that you have the right to deploy on the repository otherwise you may have an error like this :

 Access denied to http://NEXUS_ADDRESS:8081/nexus/content/repositories/snapshots/my_project/my_project/0.0.1-SNAPSHOT/my_projectm2m-0.0.1-20141125.092913-1.war. Error code 401, Unauthorized -> [Help 1]

So if you have access to the server using login/Password, you can provide that information in the .m2/setting.xml file :




<server>
    <id>all</id>
    <username>user</username>
    <password>password</password>
</server>

If you like the post, and it helps you, don't forget to share 

No comments :

Post a Comment

Articles les plus consultés