首先,需要在工程中申明工件部署到私服上的地址,如:
<distributionManagement>
<repository>
<id>nexus.release</id>
<name>Internal Release Repository</name>
<url>dav:http://10.63.13.139:8080/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>nexus.snapshots</id>
<name>Internal Snapshot Repository</name>
<url>dav:http://10.63.13.139:8080/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement
然后再对工件发布到私服上的传输方式配置插件:
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav-jackrabbit</artifactId>
<version>1.0-beta-7</version>
</extension>
</extensions>
除了上面这个方式进行发布以外,还有各种传输协议来支持工件到私服的传输,详细信息请参照:http://maven.apache.org/plugins/maven-deploy-plugin/
最后还需要在你的settings.xml文件中配置以下的信息:
<servers>
<server>
<id>nexus.release</id>
<username>admin</username>
<password>mes123</password>
</server>
<server>
<id>nexus.snapshots</id>
<username>私服的用户名</username>
<password>私服的密码</password>
</server>
</servers>
servers->server->id的名字如例子中的nexus.release或nexus.snapshots应该工程中的配置信息
distributionManagement->repository/snapshotRepository->id的名字对应。
配置完成以后,就可以在该MAVEN工程的路径下执行:maven deploy 命令来进行布置了。