nexus中央仓库中发布自己的jar包
1、后台上传
通过nexus后台上传第三方包: http://blog.csdn.net/huchunlinnk/article/details/17789175
上面上传的只能上传release版本
2、配置部署
可以发布release也可以上传snapshosts版本.
在maven的目录的全局配置settings.xml中增加对应的仓的管理认证
找到servers节点,增加snapshosts部署的账号信息(管理员login账号)
在项目的pom中增加如下配置
<distributionManagement>
<snapshotRepository>
<id>snapshots</id>
<url>http://tools.nexus.local.com/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
该配置文件来自
说明:上面的pom中distributionManagement子节点snapshotRepository可以有多个,每个独立的id,必须配置的和servers中server节点的id保证一直.
同理可以增加release版本的发布配置:
<distributionManagement>
<repository>
<id>releases</id>
<url>http://tools.nexus.local.com/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>http://tools.nexus.local.com/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
如图为mvn: clean install deploy 后仓库中部署的jar
附录:生成源代码插件
<build>
<finalName>com-yyt-yim</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<configuration>
<encoding>UTF-8</encoding>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>dat</nonFilteredFileExtension>
</nonFilteredFileExtensions>
<outputDirectory />
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
转载请注明出处:[http://www.cnblogs.com/dennisit/p/4597324.html]
热爱生活,热爱Coding,敢于挑战,用于探索 ...