【发布时间】:2015-02-24 20:29:09
【问题描述】:
我被添加为 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 项目中检查我的访问权限?
【问题讨论】:
-
根据您的配置,快照和阶段存储库有两个相同的 ID。我不建议这样做。除此之外,您是否尝试使用给定的凭据登录 oss nexus ?此外,您为什么使用 nexus-staging 插件而不是通常的部署插件?
-
我按照 Apache Maven 文档central.sonatype.org/pages/apache-maven.html 在示例中使用相同的 ID。他们的建议错了吗?
-
再过一次。您是否尝试使用给定的凭据登录?成功了吗?
-
我可以在这里登录:oss.sonatype.org。但我无法登录我已安装并启动的本地 Nexus OSS。 “用户名、密码不正确或无权使用 Nexus 用户界面。重试。请先登录,然后再尝试进一步请求。”我不确定是否需要本地 Nexus OSS 才能发布到远程存储库。
-
我可以在这里登录:oss.sonatype.org。但我无法使用相同的凭据登录我的本地 Nexus OSS。我不确定是否需要本地 Nexus OSS 才能发布到远程存储库。
标签: maven maven-3 sonatype maven-central