Setting up Maven in Jenkins: A Comprehensive Tutorial

  What is Maven?                                   The Maven is one of the build tools, which is used in the CICD pipeline to build the pack...


 

What is Maven?

                            The Maven is one of the build tools, which is used in the CICD pipeline to build the package like a jar, war.. etc

To install the maven locally we need to download the source code package from the Apache official website

Apache Official URL:  https://maven.apache.org/download.cgi

To download the Maven package from the Apache website use the below command on the linux machine

Command: wget https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz

I am downloading maven 3.8.6 you can download the latest Maven version using the above Apache official url

Untar the downloaded file and move the name as maven and mv the directory into the /opt directory.

Commands:

tar -xvf apache-maven-3.8.6-bin.tar.gz

mv apache-maven-3.8.6  /opt/

mv apache-maven-3.8.6   maven






Once maven is placed in the /opt we need to set the maven path in env.variables for that we need to edit the .bash_profile file and add the below lines.

M2_HOME=/opt/maven

M2=/opt/maven/bin

Path add the $M2_HOME:$M2



After the update we need to verify whether the env.variables are set or not, to verify using the below command.

source ~/.bash_profile
echo $PATH



Checking the maven version by running the below command

Command: mvn --version 



Now successfully maven installed, we need to setup the maven path in the Jenkins

To set up Maven click manage Jenkins → Global Tool configuration and scroll down until the Maven installations step.


Click add Maven → For the name need to give them as maven and maven_home path also need to give the home path /opt/maven → click apply and save.

Now all setup is completed, we can create the new maven project with SCM and check

Log in to Jenkins and create a new job by clicking the option new item and create the maven build job
Create the new job log in the Jenkins -- > create the job --> give the name of the job --> click maven project

In the Configuration of git, you need to give the maven project, I had a repo in my GitHub account.

Save and run the Jenkins job and see the logs
The Maven project successfully created and ran it successfully.


----------------------------------------!!!! Happy Learning with Techiev !!!!!!!!---------------------------------

-------------------------Subscribe our Youtube Channel by clicking the below link---------------------- ----------------------------!!https://www.youtube.com/@techieview729!!---------------------













 










 

Name

AWS,14,Devops,24,linux,10,
ltr
item
Techie View: Setting up Maven in Jenkins: A Comprehensive Tutorial
Setting up Maven in Jenkins: A Comprehensive Tutorial
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQ_VoN1g4Sg7s25nQJjwDfI9IpGP0F4_IHmC3fRR6EJoeoowKikShNxFIj3Fjyy-qw4G6XdfaAO0uxxsEDQRGcMfl7mtK3HXYgi_e9mZ0yWZ8zZsoaTRwDhkaaYjrypO86CB0HddkSNyc0h00WK4uaLRROtUyiykhGVCdSQQ77H3-4y8qHPuE52QnqBw/w400-h115/1_M7gYkSDwC5ny9SxxBwzozA.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQ_VoN1g4Sg7s25nQJjwDfI9IpGP0F4_IHmC3fRR6EJoeoowKikShNxFIj3Fjyy-qw4G6XdfaAO0uxxsEDQRGcMfl7mtK3HXYgi_e9mZ0yWZ8zZsoaTRwDhkaaYjrypO86CB0HddkSNyc0h00WK4uaLRROtUyiykhGVCdSQQ77H3-4y8qHPuE52QnqBw/s72-w400-c-h115/1_M7gYkSDwC5ny9SxxBwzozA.png
Techie View
https://www.techiev.com/2022/07/how-to-install-maven-in-jenkins-linux.html
https://www.techiev.com/
https://www.techiev.com/
https://www.techiev.com/2022/07/how-to-install-maven-in-jenkins-linux.html
true
7013663511659419322
UTF-8
Loaded All Posts Not found any posts VIEW ALL View Full Article Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy