1.官網下載apache-maven-3.3.9:https://maven.apache.org/download.cgijava
下載linux版本後,解壓到你想要安裝的路徑,個人爲:/opt/apache-maven-3.3.9linux
注意:須要提早安裝好java jdk 並配置好環境變量
shell
2.配置環境變量:apache
vi /etc/profile
文件末尾添加以下配置,重啓系統後,環境變量生效maven
#set maven environment MAVEN_HOME=/opt/apache-maven-3.3.9 //你的maven安裝路徑 export MAVEN_OPTS="-Xms256m -Xmx512m" export PATH=$MAVEN_HOME/bin:$PATH
3.配置用戶maven本地倉庫的路徑,setting.xml插件
vi /opt/apache-maven-3.3.9/conf/setting.xml
在文件中找到:code
<!-- localRepository | The path to the local repository maven will use to store artifacts. | | Default: ${user.home}/.m2/repository <localRepository>/path/to/local/repo</localRepository> -->
在後面添加一行:xml
<!-- localRepository | The path to the local repository maven will use to store artifacts. | | Default: ${user.home}/.m2/repository <localRepository>/path/to/local/repo</localRepository> --> <localRepository>/usr/code/repository/maven</localRepository>//maven本地倉庫的路徑
4.執行一下下面的命令,下載一下maven插件it
mvn help:system
等待下載完成便可
class