您的位置:首页 > 其它

idea打包jar和源码到maven私服

2016-10-26 00:00 381 查看
如何发布一个pom项目且打包maven源码,将源码包与jar包一同deploy到mavenserver
需要在要发布的pom项目里的pom.xml里添加如下内容:

<project>
<build>
<plugins>
<!--   要将源码放上去,需要加入这个插件    -->
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.1</version>
<configuration>
<attach>true</attach>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>company releases repositories</name>
<url>http://mvnrepo.xxxx.com/mvn/releases</url>
</repository>
<!--
use the following if you ARE using a snapshot version. -->
<snapshotRepository>
<id>nexus-snapshots</id>
<name>company releases repositories</name>
<url>http://mvnrepo.xxxx.com/mvn/snapshots</url>
</snapshotRepository>

</distributionManagement>
</project>

然后执行 mvn deploy 即可.
如单独的打源码包可执行 mvn source:jar
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: