Sunday, November 14, 2021

Integrate Artifactory with Jenkins - Upload Artifacts from Jenkins to Artifactory - How to Integrate Jenkins with Artifactory

How to Integrate Jenkins with Artifactory?

You can install Artifact plug-in to integrate Artifactory with Jenkins. Let us see how to integrate Jenkins with Artifactory and able to upload War/Ear/Jar files using Maven.



Pre-requisites:
Install Artifactory plugin in Jenkins.
go to Jenkins, Manage Jenkins, Manage plug-ins page, search for artifactory under available tab.

Make sure Maven 3 is also configured under Manage Jenkins--> Global Tool configuration
Enter Name as Maven3
/usr/share/maven as MAVEN_HOME

Configure Arifactory in Jenkins:
Once you successfully install Artifactory plug-in, 
1. Go to Manage Jenkins, Click on configure system. Look for JFrog section, click on JFrog Platform instance.
Enter some name for Instance_ID and enter Artifactory url like below:
http://public_dns_name:8081/artifactory
 


2. Click on Advanced configuration
Enter Artifactory URL again
http://public_dns_name:8081/artifactory

 and also distribution URL as below
http://public_dns_name:8081/distribution

3. Add Credentials Entry


Enter admin as username and enter Artifactory password as Admin123
Click on Test connection to verify everything is right.

4. Once you installed the above plug-in, click on existing Freestyle job configuration.
4. Go under Build environment
Select Maven 3 - Artifactory integration check box
and click on refresh Repositories and choose repos as mentioned below:


 5.Click on Add Build step and choose Invoke Artifactory Maven 3

6. Enter value as below, MyWebApp/pom.xml as root POM
and goal as install

7. Now click on Build, Jenkins should build using Maven and upload WAR file into Artifactory.

8. Login to Artifactory, Click on Artifactory --> Artifacts


Click on Builds to see the artifacts



That's it folks!

No comments:

Post a Comment