gpt4 book ai didi

maven - 发布到 Maven Central

转载 作者:行者123 更新时间:2023-12-01 07:35:41 33 4
gpt4 key购买 nike

我作为开发人员被添加到 Maven 项目中,现在我需要发布一个版本。我已将 nexus-staging-maven-plugin 添加到 pom.xml 文件。

<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.3</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>

我还添加了 distributionManagementpom.xml

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

我已将我的凭据放入 ~/.m2/settings.xml

<settings>
<servers>
<server>
<id>ossrh</id>
<username>divanov-oss.sonatype.org-account</username>
<password>divanov-oss.sonatype.org-password</password>
</server>
</servers>
</settings>

我还尝试在 oss.sonatype.org 上创建和使用“访问用户 token ”作为我的凭据。

现在我正在执行将发布部署到 Maven Central。

mvn clean deploy

最终出现错误:

[ERROR] Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.3:deploy
(injected-nexus-deploy) on project project: Failed to deploy artifacts:
Could not transfer artifact
project:jar:4.4.0-20141228.104011-1 from/to ossrh
(https://oss.sonatype.org/content/repositories/snapshots): Access denied to:
https://oss.sonatype.org/content/repositories/snapshots/project/project/4.4.0-SNAPSHOT/project-4.4.0-20141228.104011-1.jar,
ReasonPhrase: Forbidden. -> [Help 1]

[INFO] Performing remote staging...
[INFO]
[INFO] * Remote staging into staging profile ID "329a0bc2b7ce06"
[ERROR] Remote staging finished with a failure: 403 - Forbidden
[ERROR]
[ERROR] Possible causes of 403 Forbidden:
[ERROR] * you have no permissions to stage against profile with ID "329a0bc2b7ce06"? Get to Nexus admin...

如何在我尝试发布的 Maven 项目中检查我的访问权限?

最佳答案

您的凭据可能没问题,否则您会收到 401 错误。你得到 403(禁止)。这意味着凭据已被接受,但您无权发布 Artifact 。最常见的原因是您使用的 Maven 组 ID 与分配给您的组 ID 不同。在 https://issues.sonatype.org 提交问题在“社区支持 - 开源项目存储库托管”中,我们会解决这个问题。

关于maven - 发布到 Maven Central,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27675557/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com