I have a project structure like this:
- parent-project : pom.xml
+ child-project: pom.xml
+ child-project-2: pom.xml
I would like to upload the artifact of child-project to Nexus, so in pom.xml file of my child-project, I defined:
<distributionManagement>
<repository>
<id>nexus</id>
<url>http://my-repo:8081/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>nexus</id>
<url>http://my-repo:8081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
And when I run the child-project with mvn clean deploy
from eclipse, the jar file of child-project is uploaded to my-repo nexus repository as expected.
In Jenkins I have an job which is configured with the parent-project pom.xml. Now I would like to publish the artifact of my child-project to nexus after jenkins finished the build process. What I have done so far is:
- Downloaded and installed the Nexus Platform Plugin in Jenkins
- Configured the Nexus Repository Manager Servers with the credential to my Nexus 3.x Server in Jenkins System Configuration
- In the Post-Build tab, I added a new Nexus Repository Manager Publisher with the Info about my nexus repository but now getting stuck at the Maven Artifact session as below:
What make me confused here are:
- what should I put in the Maven Artifact session? I tried
child-project/target/child-project-0.0.1-SNAPSHOT.jar
but it did not work. Jenkins threw an exception
java.io.IOException: child-project/target/child-project-0.0.1-SNAPSHOT.jar does not exist
- Why do I need to specify the version of the artifact here? Does it mean that every time I change the version of my child-project, then I have to come here and modify the version?
- If I already defined in pom.xml of my child-project the session with Info about the Nexus repo, why do I need to define it here again?
- Is it possible that I configure the job build directly with
mvn clean deploy
like I did in eclipse to push the artifact to nexus? If yes then I dont need the Nexus Repository Manager Publisher anymore? And how can I configure the authentication for the nexus server like what I have in setting.xml in my /.m2 folder?
Can anyone help me to clarify the points above? Thank you very much!
mvn clean deploy
also you can click on the advance tab to specify the settings.xml file location. – rohit thomas