maven release插件将一版本发布到仓库中时Return code is: 401, ReasonPhrase:Unauthorized
2016-07-21 20:29
651 查看
需要在maven的setting.xml中配置servers.server节点,其值为nexus的对应的repository的id以及用户名及密码
[html] view plain copy
<servers>
<server>
<id>releases</id>
<username>admin</username>
<password>admin</password>
</server>
<server>
<id>snapshots</id>
<username>deployment</username>
<password>deployment</password>
</server>
</servers>
mvn release:prepare -Pxxxx 将用setting.xml中定义的profile为我们提交,打tag,升级pom,再提交的一连串动作(但不要忘了setting.xml的profile定义及pom.xm中定义好maven-release-plugin的tagBase,username,password以及每个模块的scm信息)
maven conf/setting.xml
[html] view plain copy
<profiles>
<profile>
<id>xxxx</id>
<properties>
<svn.name>username</svn.name>
<svn.pwd>password</svn.pwd>
</properties>
</profile>
</profiles>
项目 pom.xml (让子模块都继承自另一个模块,类型为pom,假定名称为parent)
[html] view plain copy
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>xxx.xx.xxx</groupId>
<artifactId>xxxx</artifactId>
<version>0.3-SNAPSHOT</version>
</parent>
<groupId><u><span style="color:#0066cc;">xxx.xx.xxx</span></u></groupId>
<artifactId>parent</artifactId>
<name>parent</name>
<packaging>pom</packaging>
<scm>
<connection>scm:svn:https://192.168.1.88/svn/xxxx/trunk/parent</connection>
<url>https://192.168.1.88/svn/xxxx/trunk/parent</url>
</scm>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<tagBase>https://192.168.1.88/svn/xxxx/tags/</tagBase>
<username>${svn.name}</username>
<password>${svn.pwd}</password>
</configuration>
</plugin>
</plugins>
</build>
</project>
这样mvn release:perform时maven-release-plugin会自动帮我们签出刚才打的tag,然后打包,分发到远程Maven仓库中(nexus).
注意:如果要把快照版本也发布到存储库,需要在trunk中执行mvn deploy,并且一定要配置snapshotRepository
[html] view plain copy
<servers>
<server>
<id>releases</id>
<username>admin</username>
<password>admin</password>
</server>
<server>
<id>snapshots</id>
<username>deployment</username>
<password>deployment</password>
</server>
</servers>
mvn release:prepare -Pxxxx 将用setting.xml中定义的profile为我们提交,打tag,升级pom,再提交的一连串动作(但不要忘了setting.xml的profile定义及pom.xm中定义好maven-release-plugin的tagBase,username,password以及每个模块的scm信息)
maven conf/setting.xml
[html] view plain copy
<profiles>
<profile>
<id>xxxx</id>
<properties>
<svn.name>username</svn.name>
<svn.pwd>password</svn.pwd>
</properties>
</profile>
</profiles>
项目 pom.xml (让子模块都继承自另一个模块,类型为pom,假定名称为parent)
[html] view plain copy
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>xxx.xx.xxx</groupId>
<artifactId>xxxx</artifactId>
<version>0.3-SNAPSHOT</version>
</parent>
<groupId><u><span style="color:#0066cc;">xxx.xx.xxx</span></u></groupId>
<artifactId>parent</artifactId>
<name>parent</name>
<packaging>pom</packaging>
<scm>
<connection>scm:svn:https://192.168.1.88/svn/xxxx/trunk/parent</connection>
<url>https://192.168.1.88/svn/xxxx/trunk/parent</url>
</scm>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<tagBase>https://192.168.1.88/svn/xxxx/tags/</tagBase>
<username>${svn.name}</username>
<password>${svn.pwd}</password>
</configuration>
</plugin>
</plugins>
</build>
</project>
这样mvn release:perform时maven-release-plugin会自动帮我们签出刚才打的tag,然后打包,分发到远程Maven仓库中(nexus).
注意:如果要把快照版本也发布到存储库,需要在trunk中执行mvn deploy,并且一定要配置snapshotRepository
相关文章推荐
- HUAWEI TAG-AL00 找IMEI的过程
- 百练 03 复杂的整数划分问题
- Java之详解坦克大战游戏(六)
- jQuery 3.0新特性总结
- 【CodeForces】611A - New Year and Days(水)
- 面试题50:树中两个节点最低公共祖先
- Spring主要核心
- 百度工程师讲PHP函数的实现原理及性能分析(三)
- Junit测试出现空指针异常
- 百度工程师讲PHP函数的实现原理及性能分析(二)
- 百练 4155 鸣人和佐助
- JAVA CAS原理深度分析
- hdu g++开栈
- 模数转换器(ADC)的基本原理【转】
- java 从String中匹配数字,并提取数字
- HDU 1527 取石子游戏 【威佐夫(Wythoff)博弈入门题】
- linux的du和df命令
- HDU 5726 GCD 区间gcd查询 MAP RMQ 优化
- NKOI 3724 图腾
- 百度工程师讲PHP函数的实现原理及性能分析(一)