构建Java项目的工具一般有两种选择,一个是Maven,一个是Gradle。
这里我们选择Maven作为项目的编译工具。
1、安装包上传到linux服务器,解压
tar -zxvf apache-maven-3.6.1-bin.tar.gz -C /usr/local/
2、修改本地仓库地址
vim settings.xml
<localRepository>/usr/local/apache-maven-3.6.1/repository</localRepository>
3、配置镜像地址
<mirrors>
<mirror>
<id>aliyun</id>
<mirrorOf>*</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>
</mirrors>
4、配置环境变量
vim /etc/profile
# maven
export MAVEN_HOME=/usr/local/apache-maven-3.6.1
export PATH=$MAVEN_HOME/bin:$PATH
4、激活配置
source /etc/profile
5、验证
mvn -v
其它:配置maven的jdk版本(可以忽略)
<profile>
<id>jdk8</id>
<activation>
<jdk>1.8</jdk>
<activeByDefault>true</activeByDefault>
</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>
<activeProfiles>
<activeProfile>jdk8</activeProfile>
</activeProfiles>










网友评论