但是这只是指能够从Nexus上下载Jar,如果我们希望自己的项目能够自动deploy到Nexus上去呢,就需要在settings.xml中再增加如下代码:
<!--设置server的账号密码,使之可以deploy -->
<servers>
<server>
<id>releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>releases</id>
<mirrorOf>central</mirrorOf>
<url>http://127.0.0.1:8081/nexus/content/groups/public</url>
</mirror>
<mirror>
<!--This is used to direct the public snapshots repo in the
profile below over to a different nexus group -->
<id>snapshots</id>
<mirrorOf>public-snapshots</mirrorOf>
<url>http://127.0.0.1:8081/nexus/content/groups/public-snapshots</url>
</mirror>
</mirrors>
同时需要在项目的POM文件里增加:
<!-- deploy path -->
<distributionManagement>
<repository>
<id>releases</id>
<name>Internal Releases</name>
<url>http://127.0.0.1:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Internal snapshots</name>
<url>http://127.0.0.1:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
好了,这样就完成了Nexus使用配置了。
Maven 的详细介绍:请点这里
Maven 的下载地址:请点这里
本文永久更新链接地址:http://www.linuxidc.com/Linux/2014-06/103054.htm
