maven打包jar上传到nexus

首先配置nexus

如果nexus返回400,那就是这里没配好

pom.xml增加节点:

<distributionManagement>
    <repository>
        <id>nexus-3rd</id>
        <url>http://192.168.0.231:8081/nexus/content/repositories/thirdparty/</url>
    </repository>
</distributionManagement>

plugins增加节点上传源码包

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-source-plugin</artifactId>
    <executions>
        <execution>
            <id>attach-sources</id>
            <goals>
                <goal>jar</goal>
            </goals>
        </execution>
    </executions>
</plugin>

在setting中设置:

  <server>
   <username>admin</username>       
   <password>123456</password>          
   <id>nexus-3rd</id>
  </server>

最后执行,  意味跳过单元测试: -Dmaven.test.skip=true

mvn deploy -Dmaven.test.skip=true

猜你喜欢

转载自my.oschina.net/u/2271162/blog/869329