欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

mvn release:perform Return code is: 401, ReasonPhrase: Unauthorized.  

程序员文章站 2022-04-04 17:18:33
...

mvn:release:perform时

会先读$MAVEN_HOME/conf/setting.xml

再读$USER_HOME/.m2/setting.xml

$USER_HOME/.m2/setting.xml会覆盖$MAVEN_HOME/conf/setting.xml

且需注意pom.xml里的

 

<!-- mvn deploy时发布项目到仓库 -->
	<distributionManagement>
		<snapshotRepository>
			<id>snapshots</id>
			<url>http://172.16.0.205:8081/nexus/content/repositories/snapshots/</url>
			<!-- 不会生成多个含时间戳的版本 -->
			<uniqueVersion>false</uniqueVersion>
		</snapshotRepository>
		<repository>
			<id>releases</id>
			<url>http://172.16.0.205:8081/nexus/content/repositories/releases/</url>
		</repository>
	</distributionManagement>

 snapshotRepository 与 repository的id

需与setting.xml里的server的id一致

<servers>
		<server>
			<id>releases</id>
			<username>admin</username>
			<password>xxxxxxx</password>
		</server>
		<server>
			<id>thirdpart</id>
			<username>admin</username>
			<password>xxxxxxx</password>
		</server>
		<server>
			<id>snapshots</id>
			<username>admin</username>
			<password>xxxxxxx</password>
		</server>
		
	</servers>