一、maven目录conf的setting.xml里配置:
<servers>
<!-- server
| Specifies the authentication information to use when connecting to a particular server, identified by
| a unique name within the system (referred to by the 'id' attribute below).
|
| NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
| used together.
|
-->
<server>
<id>nexus-releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>nexus-snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
<!-- Another sample, using keys to authenticate.
<server>
<id>siteServer</id>
<privateKey>/path/to/private/key</privateKey>
<passphrase>optional; leave empty if not used.</passphrase>
</server>
-->
</servers>
二、pom.xml文件配置
<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>releases</name>
<url>http://172.56.3.242:8081/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>snapshots</name>
<url>http://172.56.3.242:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
三、执行mvn命令
本地仓库的更新
mvn clean package install
远程仓库的更新
mvn clean package deploy