1.新建 hosted 类型的 Repository,如下
修改配置, Deployment Policy 属性为:Allow Redeploy
2.pom.xml中添加如下配置
<distributionManagement> <repository> <id>nexus-release</id> <name>project release repository</name> <url>http://localhost:8081/nexus/content/repositories/maven-release/</url> </repository> <snapshotRepository> <id>nexus-snapshots</id> <name>project snapshots repository</name> <url>http://localhost:8081/nexus/content/repositories/maven-snapshots/</url> </snapshotRepository> </distributionManagement>
3.maven server.xml中添加如下配置,注意 id标签要与pom.xml中的配置一致。
<server>
<id>nexus-release</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>nexus-snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>