我是作为开发人员添加到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>此外,我还将distributionManagement添加到pom.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上创建和使用“访问用户令牌”作为我的凭据。
现在我正在执行将发行版部署到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项目中检查我的访问权限?
发布于 2014-12-29 14:14:39
你的证书很可能很好,否则你会得到401错误。你会得到403 (被禁止)。这意味着凭证已被接受,但您没有发布工件的权限。最常见的原因是您使用的是与分配给您的组ID不同的Maven组ID。在https://issues.sonatype.org的“社区支持-开放源码项目库托管”中提出一个问题,我们会解决这个问题的。
发布于 2014-12-28 11:07:47
您需要使用的凭据不应该是Sonatype JIRA,而是oss.sonatype.org。你需要在那里单独注册。
更新问题被改变了,所以这个答案不再相关了。我留着,因为这是个常见的错误。
https://stackoverflow.com/questions/27675557
复制相似问题