This article demonstrates how to install maven on CentOS7.
http://maven.apache.org/download.cgi
Find the package address of the Binary tar.gz archive in the download list. Take version 3.5.4 as an example, the address is:
http://apache.communilink.net/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.tar.gz
SSH to the host where maven is installed, such as 192.168.1.101, execute the command:
$ mkdir /usr/local/maven
$ wget http://apache.communilink.net/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.tar.gz
$ tar -zxvf apache-maven-3.5.4-bin.tar.gz -C /usr/local/maven
$ vi /etc/profile
# Add the following at the end of the file
export MAVEN_HOME=/usr/local/maven/apache-maven-3.5.4export PATH=$PATH:$MAVEN_HOME/bin
$ source /etc/profile
$ mvn -v
If the installation is successful, it will display:
Apache Maven 3.5.4(3383c37e1f9e9b3bc3df5050c29c8aff9f295297;2018-02-25T03:49:05+08:00)
Maven home:/usr/local/maven/apache-maven-3.5.4
Java version:1.8.0_161, vendor: OpenJDK
Java home:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161/jre
Default locale: en_US, platform encoding: UTF-8
OS name:"linux", version:"4.15.2-1.el7.elrepo.x86_64", arch:"amd64", family:"unix"
Open the configuration file setting.xml and modify the path of the local maven warehouse:
$ vi $MAVEN_HOME/conf/settings.xml
# Set the path of the local maven repository
< localRepository>/var/lib/maven/repo</localRepository>
Recommended Posts