Maven中央仓库更新后老版本如何提交-异常401 Content access is protected by toke
[toc]
# 问题
前段时间中央仓库更新版本后,我们提交Jar包到中央仓库失败了,提示401 Content access is protected by token
通过提示能够看出来是没有权限提交
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.403 s
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project log4j-2-kafka-java: Failed to deploy artifacts: Could not transfer artifact wiki.hadoop:log4j-2-kafka-java:jar:1.0.6 from/to ossrh (https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/): Transfer failed for https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/wiki/hadoop/log4j-2-kafka-java/1.0.6/log4j-2-kafka-java-1.0.6.jar 401 Content access is protected by token -> [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
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
# 解决方法
进入
Profile
页面
点击
Access User Token
,获取弹出的token将配置放入Maven的
settings.xml
配置文件中tips:
- ${server}修改为ossrh
- 删除之前的配置,之前是使用的账号密码进行的认证
<server> <id>ossrh</id> <username>xxxx</username> <password>xxxxxxxxxxxx</password> </server>
1
2
3
4
5重新提交可以成功提交了
上次更新: 2024/07/12, 13:19:37