Hi All, this document deals with how to upload artifacts to Nexus repository using Jenkins.
Here we have a sample java application and the objective of the document is to upload all the artifacts to Nexus repository using Jenkins.
Nexus support of various kinds of application repository, maven, docker, yum, etc.

Prerequisites

* Java application if you don’t have you can fork my repository

https://github.com/prabhinmp/maventest.git

* Running Jenkins server if you don’t have, follow this link Setup Jenkins in ubuntu server
* Running Nexus repository management system, if you don’t have, follow this link. how to install nexus repository in Linux machine
* If you don’t have any idea about to build a java application using Jenkins refer this link. how to build a maven application using Jenkins

Configuration

Step 0. Install Nexus Artifact uploader from manage plugins.
Step 1. Create a Jenkins job.


Step 2. Configure Jenkins to build the job.
Step 3. Configure your Git repository or SVN.


Step 4. Configure the build as given below.


Step 5. Select Nexus artifact uploader from Post steps drop down and configure as follows

Nexus Version 
Protocol HTTP/HTTPS
Nexus URL localhost:8081
Credentials add the nexus user credentials to upload the artifacts
GroupId ${POM_GROUPID}
Version ${POM_VERSION}
Repository maven-snapshots
ArtifactId ${POM_ARTIFACTID}
Type ${POM_PACKAGING}
File target/${POM_ARTIFACTID}-${POM_VERSION}.${POM_PACKAGING}

The values for the above variables are retrieved from the pom.xml file

Step 6: Now save the job and start building. See the console output to see the job live status.


Step 7: Now you can see from the Console output artifacts are uploaded. Check the Nexus repository to see the artifacts.

© 2019, Techrunnr. All rights reserved.

#1
#2
#3
Questions Answered
Articles Written
Overall Points

Prabhin Prabharkaran

He is Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!!

0 Comments

Leave a Reply

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.