DevOps CI/CD - Upload war file to Nexus using Jenkins Pipeline as Code

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys to devop see ICT tutorial series as part of this video we will see how to upload war files to nexus using jenkins declarative pipeline in previous video I have shown you how to install and configure Sona type Nexus as a service online Xbox to a project Jenkins file we want to add a new stage for uploading artifacts you let's call it upload war file to Nexus Here I am in Jenkins dashboard for this we need Here I am in Jenkins dashboard for this we need to install a plugin let's go to homepage manage Jenkins manage plugins let's go and check and available we are interested in Nexus artifact uploader and select that and install this plugin plug-in installed successfully let's get back to our simple app shop and let's open pipeline syntax okay meanwhile what we have to do is we need to create a deposit clean Nexus before we start uploading artifacts to it let's grab its public IP and 8081 yes we already logged in after we log in go to a configuration repositories and I want to create my one repository for storing my artifacts click on create repository so here I want to store maven artifacts nothing but war jar or er it has to be hosted it's called a simple app release it's basically a repository where we're going to store the artifacts related to simple app okay I mean that type of artifacts it's going to hold name and generally deals with snapshot and release I want this only for release and layout policy say strict up Amish you just keep the default value there blob storage default and the rest is default create this repository so this is the one simple app release this is going to be the container for our war files now let's get back to a snippet generator Nexxus artifact uploader the version of Nexus history protocol is HTTP okay and the URL of Nexus and picking private IP in this case because my Jenkins and Nexus or running in same network they can talk to each other using private eye piece the next step is to provide credentials for Nexus so I have already created this but let me show it again let me delete that existing credentials okay so all right let me close this once again let me open pipeline syntax should be Nexxus artifact uploader that's CIP go to add select Jenkins I need to store user name and password of my Nexus unique ID and description all right now the group ID of the artifact we are going to upload so they are actually dealing with simple app we'll find that information inside combat XML so group ID is in dot Java home the version so actually I want to update the version and make it 1.0.0 1.0.0 the repository URL this is the one we are interested in you wasn't she well fine so we actually provided the Nexus version the protocol URL is an impartial group ID the version the location where I had to keep my artifacts plus and also I need to tell where to find my artifacts on my Jenkins mission because we are going to build the artifacts on Jenkins which will be on Jenkins local box so that location I need to provide so add our tips at right since lab so type it's war so classifier you can leave it and the location of the file so usually a memin creates artifacts under target folder so target slash one second here name of the application dot I mean it's not war version - version which is 1.0.0 dot you are soil so I have filled in all the details about my artifact and about my Nexus where I am going to store artifact so if you wanna upload multiple artifacts you can click Add and go that so generate this copy the code I'm back too our local workspace lest it you like he aligned this to increase the readability you okay so Nexus you are I need to mention its port number as well all right in the script there are many fields which is hard-coded for example washing is hard-coded next time when I change my Washington palm file it has to be something new but it's hard-coded now if that's the case when it every time update the version in this script if washin is updated in pom dat XML soon I will also show you how to pick these values dynamically from pom not XML and assign it here first of all I want to make sure this plug-in is working and it's able to upload artifacts to Nexis after that I will improve this piece of code let's open this now terminal let me add chicken spy so please ignore this one this was used part of some other example you you so it seems there are changes in Ramat which is rejecting our operation so let's do gate okay we also got some conflict let's delete this guy you you you all right yeah let's cross-check the stuff here alright now let's come back to this build Oh Jenkins job should check out the call from our gate and it has to do its job you so upload artifacts failed okay I believe this additional slash might be causing issue okay that's just commit let's push it let's rate trigger the job still something is going wrong let me cross verify it okay simple app - 1.0 0.5 group ID in Java home let me check this offline and I'll be back with the solution okay finally we made it work I'll explain what was the problem we had how I fixed it one problem was here earlier we had full repository URL so instead of that I kept only the repository name so it should be only this name but instead I kept a complete URL that was one issue the second issue was earlier the version was Nexus - so I made it Nexus 3 so after making these changes our code started working now we see that success message which says uploaded war files to Nexus repository let's go there click on browse and simple app we should see that simple app 1.00 with the wall 5 in next video I will show you how to dynamically change the required fields here whenever the version you know form directional changes
Info
Channel: Java Home Cloud
Views: 16,576
Rating: 4.9469028 out of 5
Keywords: java home, devops, java home cloud, devops tutorial, devops by javahome, devops by java home cloud, aws by javahome, jenkins pipeline, jenkins tutorial, jenkins pipeline example, how to deploy war file to nexus using jenkins pipeline script, jenkins pipeline groovy, jenkins pipeline tutorial, upload war to nexus, jenkins nexus integration
Id: p_Wo3aqUJto
Channel Id: undefined
Length: 15min 18sec (918 seconds)
Published: Wed Feb 19 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.