CentOS Maven使用

1.下載壓縮包

http://maven.apache.org/download.cgi

2.上傳到服務器並解壓

tar -xzvf apache-maven-3.6.3-bin.tar.gz

3.修改配置文件

#解壓目錄裏 conf/settings.xml
<localRepository>/usr/local/maven/repository</localRepository>
<mirror>
        <id>alimaven</id>
        <name>aliyun maven</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
        <mirrorOf>central</mirrorOf>
    </mirror>
<profile>
     <id>jdk-1.8</id>
     <activation>
       <activeByDefault>true</activeByDefault>
       <jdk>1.8</jdk>
     </activation>
       <properties>
         <maven.compiler.source>1.8</maven.compiler.source>
         <maven.compiler.target>1.8</maven.compiler.target>
         <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
       </properties>
    </profile>

4.設置環境變量

#/etc/profile
MAVEN_HOME=/usr/local/maven/apache-maven-3.6.3
export PATH=${MAVEN_HOME}/bin:${PATH}
#加載環境變量
source /etc/profile

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章