How to install Maven on CentOS/RHEL/Fedora?
Hello dear DevOps Hunter! In this exciting post we will discuss on the most popular build tool 'Maven'. Maven is an Open source project under the Apache Licence. It is one of the best speeding software project management tool.
Maven 3 installation on CentOS RHEL Fedora |
Using Apache Maven we can do the following tasks:
- extract source code
- build the package
- deploy to target
- test the application basic sanity
The trending build tool for Java enterprise level Projects, it works based on 'pom.xml' file a Project Object Model (POM). The greatest advantage of Maven is plugin support for libraries.
Install Maven
There are two basic distributions of Maven installers: binary and source archives. If you need the installation should be done quick then use the binary installer, where you need simple extraction of archives. On the other hand, source archives will take time and three steps you need to follow: configure, make and make install. So here I am selecting the first method - binary archive installation.
Tip: Always visit the maven official site where you can find the latest version archives.
Prerequisites:
- Your machine must have archiving tools to extract the maven installers. There are 4 downloads choices for maven.
- Any JRE (Oracle JRE/OpenJRE) must be installed
Steps-by-Step Maven 3 installation
Step 1: First download in /tmp, Then, navigate where you want to install the maven build tool.cd /tmp wget http://mirrors.estointernet.in/apache/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz
Step 2: Now installation directory
Best Practice: To make more easy to use the maven installation path soft link created and the same will be used in the environment setup. Step 3: Set the Environment variables in the common profile location
Save this Maven environment setting file.
Step 4: Verify the Maven installation in different users:
[root@mydev tmp]# cd /opt [root@mydev opt]# tar -zxvf /tmp/apache-maven-3.6.1-bin.tar.gz ln -s apache-maven-3.6.1 maven
Best Practice: To make more easy to use the maven installation path soft link created and the same will be used in the environment setup. Step 3: Set the Environment variables in the common profile location
vi /etc/profile.d/maven.sh #Maven environment setting export M3_HOME=/opt/maven export PATH=$M3_HOME/bin:$PATH
Save this Maven environment setting file.
Verify the installation
Step 4: Verify the Maven installation in different users:
mvn --version
This will give you the four things: Maven Path, Java vendor, JRE Path, Default locale, OS related full details.
First root user, where Open JRE in use
mvn run from root user |
Next switch to 'oracle' user where Oracle JRE in use.
mvn detecting Oracle JRE |
No comments:
Post a Comment