首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >释放到Maven Central

释放到Maven Central
EN

Stack Overflow用户
提问于 2014-12-28 10:29:31
回答 2查看 3.6K关注 0票数 3

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

代码语言:javascript
复制
<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

代码语言:javascript
复制
<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

代码语言:javascript
复制
<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中。

代码语言:javascript
复制
mvn clean deploy

在错误中结束:

代码语言:javascript
复制
[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]

代码语言:javascript
复制
[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项目中检查我的访问权限?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-12-29 14:14:39

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

票数 4
EN

Stack Overflow用户

发布于 2014-12-28 11:07:47

您需要使用的凭据不应该是Sonatype JIRA,而是oss.sonatype.org。你需要在那里单独注册。

更新问题被改变了,所以这个答案不再相关了。我留着,因为这是个常见的错误。

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27675557

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档