pom中配置:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>repositoryId</id>
<name>repositoryName</name>
<url>http://[ip]:[port]/nexus/content/repositories/XXX</url>
</repository>
</distributionManagement>
其中<id>repositoryId</id>为本地maven的setting文件中配置的server id,为登陆私库的账号。
<servers>
<server>
<id>repositoryId</id>
<username>username</username>
<password>password</password>
</server>
</servers>
至此,执行maven的deploy命令,就可以自动上传到私服了。