Setting Up Apache Maven on Jenkins-EC2 Server: Installation and Configuration and maven build Testing Guide

  What is Apache Maven?                 Apache Maven is a widely-used build automation and project management tool.             It is part o...


 

What is Apache Maven? 
            Apache Maven is a widely-used build automation and project management tool.
            It is part of the Apache Software Foundation and is designed to simplify the build process for Java-based projects. Maven uses a declarative approach, allowing developers to define project structures, and dependencies, and build configurations in a concise and standardized way.

Key features of Apache Maven

  1. Project Object Model (POM):
  2. Dependency Management
  3. Build Lifecycle
  4. Plugins
  5. Convention over Configuration
  6. Central Repository
Using Maven can help standardize the build process across different projects, improve collaboration, and enhance project maintainability. Many Java-based projects, especially those developed within the Apache Software Foundation, use Maven as their build tool.

How to configure Maven inside the Jenkins server?
     To install the maven locally we need to download the source code package from the Apache official website 
     Download the Package from the Maven Repo using the below command, before downloading the source code switch the /opt directory 
note: The Maven version might be changed, please check and download the latest version from the apache maven website.
commands cd /opt wget https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz
 tar -xvf apache-maven-3.8.6-bin.tar.gz
 mv apache-maven-3.8.6   maven
After downloading the File we need to the maven running path by setting it as an env variable in the linux. for that, we need to open the file .bash_profile using Vi editor. 
declare the maven path and maven's execution path as M2_HOME and M2 and set those values as env variables.

M2_HOME=/opt/maven
M2=/opt/maven/bin
Path add the $M2_HOME:$M2

Once the env variables are set run the below command to update and verify the Maven's path and verify the version of the Maven
command:
source ~/.bash_profile
echo $PATH

mvn --version


Now successfully maven installed, we need to set the maven path in jenkins
before setting up the maven Path inside jenkins we need to enable the maven integration plugins inside jenkins.



Once the plugins are installed click manage jenkins --> Tools and scroll down until the maven installations step. 
Click add Maven → for the name need to give the as maven and maven_home path also need to give the home path /opt/maven → click apply and save.

Optionally we can use install automatically to install maven. Now, we can create the new Maven project with SCM and build the package using Maven.
Log in to Jenkins and create a new job by clicking the option new item and create the maven build job


Inside the maven configuration, we need to add a github repo by clicking Git and adding the github repo. the repo you can able to find inside my github repos.



Inside the Build configuration goals need to be given as clean install click save and build the job.



Now, we need to check the logs for success and error logs, If the job is successful we can find the build package path inside the server. 



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

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

    

Name

AWS,14,Devops,23,linux,9,
ltr
item
Techie View: Setting Up Apache Maven on Jenkins-EC2 Server: Installation and Configuration and maven build Testing Guide
Setting Up Apache Maven on Jenkins-EC2 Server: Installation and Configuration and maven build Testing Guide
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlN90wfE3UWcFqGtyyHJQrEW9ySfj8guxzEKxtsF5kkKPiEZqRd1cNR5Hctus0e3LeUUuCXPx812Y9JtngyDZVG-JLta6GPNBtaHJN7lTFw4zaD13i9YqLf2lOBlql0-87QXpUZB-zq6ShhLl57UDTWe058D5kwF_lYfcwj5owFNs02ET9QG_fA3ezpQib/w640-h184/1_M7gYkSDwC5ny9SxxBwzozA.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlN90wfE3UWcFqGtyyHJQrEW9ySfj8guxzEKxtsF5kkKPiEZqRd1cNR5Hctus0e3LeUUuCXPx812Y9JtngyDZVG-JLta6GPNBtaHJN7lTFw4zaD13i9YqLf2lOBlql0-87QXpUZB-zq6ShhLl57UDTWe058D5kwF_lYfcwj5owFNs02ET9QG_fA3ezpQib/s72-w640-c-h184/1_M7gYkSDwC5ny9SxxBwzozA.png
Techie View
https://www.techiev.com/2024/01/setting-up-apache-maven-on-ec2.html
https://www.techiev.com/
https://www.techiev.com/
https://www.techiev.com/2024/01/setting-up-apache-maven-on-ec2.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