Apache Maven is a project management software, managing building, reporting and documentation of a Java development project. imilar to how the make utility builds an executable from source code and libraries using a Makefile, Apache Ant builds a Java project from its source code and libraries by using a similar XML file.
Step #1 Check Java Version
JAVA is the first requirement for Apache. Verify you have JAVA SE 6 or Later form introduced in your framework. Utilization taking after order to check in the event that you have java introduced as of now on your framework.
# java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
Step #2 Download Apache Maven
You can download the latest version from the download page also or you can use below link to download Apache Maven.
# cd /opt
# wget http://mirror.cc.columbia.edu/pub/software/apache/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.zip
Step #3 Extract Apache Maven
Extract it using following command
# unzip apache-maven-3.3.3-bin.zip
Move the extracted contents using following command:
# mv apache-maven-3.3.3/ /opt/maven
Step #4 Make Symbolink
Make a symbolink to maven/bin folder as shown below.
# ln -s /opt/maven/bin/mvn /usr/bin/mvn
Step #5 Maven environment
Create a file and add the content as below to setup Maven environment variable:
# vim /etc/profile.d/maven.sh
Add the following contents:
export PATH MAVEN_HOME
Make it executable using the following command.
# chmod +x /etc/profile.d/maven.sh
Then, set the environment variables permanently by running the following command:
# source /etc/profile.d/maven.sh
Step #6 Check Version
You can check version using following command:
# mvn -version
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T17:27:37+05:30)
Maven home: /opt/maven
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: /opt/jdk1.7.0_51/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-123.el7.x86_64", arch: "amd64", family: "unix"
Check the environment variables:
# echo $MAVEN_HOME
# echo $PATH