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
After the update we need to verify whether the env.variables are set or not, to verify using 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.
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