Last active
November 17, 2017 04:12
-
-
Save mahamuniraviraj/32da43d7ac134dfbff5bc1f1e59c798a to your computer and use it in GitHub Desktop.
install maven 3.5 on centos 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# go to https://maven.apache.org/download.cgi | |
# download latest version Binary tar.gz archive file | |
# copy /opt directory | |
cd /opt | |
# extract tar file , replace x.x with downloaded version | |
tar xzvf apache-maven-x.x.0-bin.tar.gz | |
# create soft link | |
ln -s /opt/apache-maven-x.x.0 /opt/maven | |
# verify link | |
ll | |
# set environment variable using setMavenEnv.sh file in /etc/profile.d directory | |
vi /etc/profile.d/setMavenEnv.sh | |
#press insert and type following commands t0 set maven home and mvn path | |
#!/bin/sh | |
# Sets maven home and add mvn to path | |
export M2_HOME=/opt/maven | |
export M2=$M2_HOME/bin | |
export PATH=$M2:$PATH | |
#press escape and type :wqa to save all and exit | |
# apply changes | |
source /etc/profile.d/setMavenEnv.sh | |
# test maven home | |
echo $M2_HOME | |
# test maven path | |
mvn -version | |
# Set maven repository to common shared folder , other than ${user.home}/.m2/repository | |
vi /opt/maven/conf/settings.xml | |
#search Default: ${user.home}/.m2/repository , uncomment and change path | |
#press insert and type path | |
<localRepository>/opt/mvn_repo</localRepository> | |
#press escape and type :wqa to save and exit | |
# verify changes | |
cat /opt/maven/conf/settings.xml | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment