Maven 配置
小于 1 分钟
Maven 配置
1 Downloads
- Maven latest: https://maven.apache.org/download.cgi
- Maven 3.6.3: https://dlcdn.apache.org/maven/maven-3/3.6.3/binaries/
2 环境变量
# /etc/profile
export M2_HOME=/uar/local/apache-maven-x.y.z
export PATH=$PATH:$M2_HOME/bin
# 立即生效
$ source /etc/profile
settings.xml
源与 localRepository
3 配置 <?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>D:\repository</localRepository>
<offline>false</offline>
<mirrors>
<mirror>
<id>huaweicloud</id>
<mirrorOf>*</mirrorOf>
<url>https://mirrors.huaweicloud.com/repository/maven/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.complier.source>1.8</maven.complier.source>
<maven.complier.tatget>1.8</maven.complier.tatget>
<maven.complier.compilerVersion>1.8</maven.complier.compilerVersion>
</properties>
</profile>
</profiles>
</settings>
4 Maven 本地打包命令
# 跳过单元测试
mvn clean package -Dmaven.test.skip=true
(全文完)