这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录 前一修订版 后一修订版 | 前一修订版 | ||
分享:技术:nexus:nexus安装和介绍 [2015/07/07 11:27] gxx |
分享:技术:nexus:nexus安装和介绍 [2015/07/07 12:26] (当前版本) gxx [maven发布脚本] |
||
---|---|---|---|
行 46: | 行 46: | ||
快照版本库,如果项目版本号中带SNAPSHOT都视为快照版本,执行mvn deploy会发布到该库中 | 快照版本库,如果项目版本号中带SNAPSHOT都视为快照版本,执行mvn deploy会发布到该库中 | ||
{{ :分享:技术:nexus:nexus截图8.png?300 |}} | {{ :分享:技术:nexus:nexus截图8.png?300 |}} | ||
+ | ===== maven项目使用nexus私有仓库 ===== | ||
+ | ==== 配置私服仓库 ==== | ||
+ | 在pom.xml中配置nexus私服仓库,用于从nexus中下载maven依赖 | ||
+ | <code xml> | ||
+ | <!-- 仓库配置 --> | ||
+ | <repositories> | ||
+ | <!-- nexus私服仓库 --> | ||
+ | <repository> | ||
+ | <id>nexus</id> | ||
+ | <name>Team Nexus Repository</name> | ||
+ | <url>http://121.43.104.34:8081/nexus/content/groups/public</url> | ||
+ | </repository> | ||
+ | </repositories> | ||
+ | </code> | ||
+ | ==== 配置版本发布管理 ==== | ||
+ | 在pom.xml中配置版本发布管理,用于发布**release稳定版本**和**snapshots快照版本**到nexus中。 | ||
+ | <code xml> | ||
+ | <!-- 版本发布管理 --> | ||
+ | <distributionManagement> | ||
+ | <!-- release稳定版本 --> | ||
+ | <repository> | ||
+ | <id>nexus-releases</id> | ||
+ | <name>Nexus Release Repository</name> | ||
+ | <url>http://121.43.104.34:8081/nexus/content/repositories/releases/</url> | ||
+ | </repository> | ||
+ | <!-- snapshots快照版本 --> | ||
+ | <snapshotRepository> | ||
+ | <id>nexus-snapshots</id> | ||
+ | <name>Nexus Snapshot Repository</name> | ||
+ | <url>http://121.43.104.34:8081/nexus/content/repositories/snapshots/</url> | ||
+ | </snapshotRepository> | ||
+ | </distributionManagement> | ||
+ | </code> | ||
+ | ==== maven settings配置 ==== | ||
+ | 由于nexus开发发布需要校验用户名和密码,所以maven deploy要发布成功,必须在maven的目录中修改apache-maven-3.0/conf/settings.xml,注意server标签中的id与repository标签中的id要一致,用户名密码即nexus中用户名密码 | ||
+ | <code xml> | ||
+ | <servers> | ||
+ | <server> | ||
+ | <id>nexus-releases</id> | ||
+ | <username>admin</username> | ||
+ | <password>admin123</password> | ||
+ | </server> | ||
+ | <server> | ||
+ | <id>nexus-snapshots</id> | ||
+ | <username>admin</username> | ||
+ | <password>admin123</password> | ||
+ | </server> | ||
+ | </servers> | ||
+ | </code> | ||
+ | ==== maven发布脚本 ==== | ||
+ | <code> | ||
+ | mvn clean deploy | ||
+ | </code> |