1、setting.xml配置
<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
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>/root/.m2/repository</localRepository>
<servers>
<server>
<id>dev-maven</id>
<username>admin</username>
<password>xxxx</password>
</server>
</servers>
<mirrors>
<mirror>
<id>dev-maven</id>
<name>dev-maven</name>
<mirrorOf>*</mirrorOf> <!-- 这个要配置 *,配置maven的中央地址的话,不行-->
<url>http://xx.xx.xx.22/nexus/repository/maven-public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>dev-maven</id>
<repositories>
<repository>
<id>dev-maven</id>
<name>dev-maven</name>
<url>http://xx.xx.xx.22/nexus/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled> <!-- 开启这个配置true,允许下载快照版本-->
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>dev-maven</activeProfile>
</activeProfiles>
</settings>
2、POM.xml文件配置
<repositories>
<repository>
<id>dev-maven</id>
<name>dev-maven</name>
<url>http://xxx.xxx.xx.22/nexus/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>