首页   >   代码编程   >   JAVA开发

将本地jar包发布到远程maven仓库时提示401没权限访问

上次在将本地jar包发布到远程maven仓库时,碰见了一个401问题,公司私服有好几个repository地址,所以当时就是随便挑了一个地址,结果分分钟报错没权限。

详细错误如下:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (default-cli) on project standalone-pom: Failed to deploy artifacts: Could not transfer artifact com.alibaba.xxpt.gateway.shared.client:zzding:jar:0.0.1-RELEASE from/to central (http://192.168.13.222:8081/nexus/content/repositories/central): Failed to transfer file http://192.168.13.222:8081/nexus/content/repositories/central/com/alibaba/xxpt/gateway/shared/client/zzding/0.0.1-RELEASE/zzding-0.0.1-RELEASE.jar with status code 401 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

报错截图如下:

将本地jar包发布到远程maven仓库时提示401没权限访问

远程仓库如下:

将本地jar包发布到远程maven仓库时提示401没权限访问

项目配置如下:

<repositories>
		<repository>
			<id>nexus</id>
			<name>Nexus</name>
			<url>http://192.168.13.222:8081/nexus/content/groups/public/</url>
			<releases>
				<enabled>true</enabled>
			</releases>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</repository>
		<repository>
			<id>thirdparty</id>
			<name>thirdParty</name>
			<url>http://192.168.13.222:8081/nexus/content/repositories/thirdparty/</url>
			<releases>
				<enabled>true</enabled>
			</releases>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</repository>
	</repositories>

执行命令如下:

mvn deploy:deploy-file -DgroupId=com.alibaba.xxpt.gateway.shared.client -DartifactId=zzding -Dversion=0.0.1-RELEASE -Dpackaging=jar -Dfile=E:/workspace2/java/lib/xxpt.gateway.shared.client-1.1.5.jar -Durl=http://192.168.13.222:8081/nexus/content/repositories/central -DrepositoryId=central

确定配置没写错,也确定命令没写错,那这个401只可能是账号权限的问题了,因为同事那里只有一个账号密码,但是第二张截图中看到有很多个repository,而我发布的时候写的是central,失败了,所以我就多做了几次测试证实了我的猜想。

在第二张截图中共有7个私服地址,最后只有那个thirdparty的可以发布成功,说明同事给我的那个账号密码就只是这个repository的,其他的仓库都会提示401,因为账号密码根本就不对!!!

雨落无影

QQ群Ⅰ: 686430774 (已满)

QQ群Ⅱ: 718410762 (已满)

QQ群Ⅲ: 638620451 (已满)

QQ群Ⅳ: 474195684 (已满)

QQ群Ⅴ: 463034360 (已满)

QQ群Ⅵ: 879266502 (已满)

QQ群Ⅶ: 627786015 (已满)

工作5分钟,吹逼2小时: 855525339 (娱乐消遣,广告狗勿进)

如果文章有帮到你,可以考虑请博主喝杯咖啡!

分享到:

欢迎分享本文,转载请注明出处!

作者:不忘初心

发布时间:2020-08-28

永久地址:https://www.jiweichengzhu.com/article/e4f302ddca1c42e6b8fa0b56dccc7a60

评论