Install MAVEN in 2 Minutes

                                    
                                      Image result for maven pic                         


sudo apt-get update -y
sudo apt-get upgrade -y
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update -y
sudo apt-get install oracle-java8-installer
java -version
cd /opt/
wget http://www-eu.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
sudo tar -xvzf apache-maven-3.3.9-bin.tar.gz
sudo mv apache-maven-3.3.9 maven
#####################################################################################
Next, you will need to setup the environment variables such as M2_HOME, M2, MAVEN_OPTS, and PATH. You can do this by creating a mavenenv.sh file inside of the /etc/profile.d/ directory.
###########################################################################
sudo nano /etc/profile.d/mavenenv.sh
#############################################################################
Add the following lines:
#########################################################################
export M2_HOME=/opt/maven
export PATH=${M2_HOME}/bin:${PATH}
################################################################################
Save and close the file, update its permissions, then load the environment variables with the following command:

sudo chmod +x /etc/profile.d/mavenenv.sh
##########################################################################
 source /etc/bash.bashrc
##########################################################################
sudo source /etc/profile.d/mavenenv.sh
#############################################################
mvn --version
######################################################


Comments

Post a Comment