Maven无法部署工件ReasonPhrase:Forbidden

时间:2014-08-10 11:37:00

标签: java maven

我是部署maven项目的新手,我认为我遇到的问题完全相同Failed to deploy artifacts

但是那篇文章中的答案在我的案例中没有用。

完整错误堆栈跟踪如下所示。我确保以下配置正确:

  • 我可以使用用户凭据登录oss.sonatype.org
  • 用户凭据在settings.xml中设置
  • 用户凭据在运行时显示为预期" mvn help:effective-settings"
  • pom文件中的快照服务器ID(" snapshot")匹配设置xml中的服务器ID,来自" mvn help的服务器ID输出:effective-settings"
  • 使用maven 4.0.0

高度赞赏任何建议!

[ERROR] Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1
.6.2:deploy (injected-nexus-deploy) on project jate: Failed to deploy artifacts:
 Could not transfer artifact uk.ac.shef.dcs.oak:jate:jar:2.0Alpha-20140810.08063
8-1 from/to ossrh (https://oss.sonatype.org/content/repositories/snapshots): Acc
ess denied to: https://oss.sonatype.org/content/repositories/snapshots/uk/ac/she
f/dcs/oak/jate/2.0Alpha-SNAPSHOT/jate-2.0Alpha-20140810.080638-1.jar, ReasonPhra
se: Forbidden. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
rg.sonatype.plugins:nexus-staging-maven-plugin:1.6.2:deploy (injected-nexus-depl
oy) on project jate: Failed to deploy artifacts: Could not transfer artifact uk.
ac.shef.dcs.oak:jate:jar:2.0Alpha-20140810.080638-1 from/to ossrh (https://oss.s
onatype.org/content/repositories/snapshots): Access denied to: https://oss.sonat
ype.org/content/repositories/snapshots/uk/ac/shef/dcs/oak/jate/2.0Alpha-SNAPSHOT
/jate-2.0Alpha-20140810.080638-1.jar, ReasonPhrase: Forbidden.
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:217)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
ild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to deploy arti
facts: Could not transfer artifact uk.ac.shef.dcs.oak:jate:jar:2.0Alpha-20140810
.080638-1 from/to ossrh (https://oss.sonatype.org/content/repositories/snapshots
): Access denied to: https://oss.sonatype.org/content/repositories/snapshots/uk/
ac/shef/dcs/oak/jate/2.0Alpha-SNAPSHOT/jate-2.0Alpha-20140810.080638-1.jar, Reas
onPhrase: Forbidden.
        at org.sonatype.nexus.maven.staging.deploy.DeployMojo.execute(DeployMojo
.java:216)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
BuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:209)
        ... 19 more
Caused by: org.apache.maven.artifact.deployer.ArtifactDeploymentException: Faile
d to deploy artifacts: Could not transfer artifact uk.ac.shef.dcs.oak:jate:jar:2
.0Alpha-20140810.080638-1 from/to ossrh (https://oss.sonatype.org/content/reposi
tories/snapshots): Access denied to: https://oss.sonatype.org/content/repositori
es/snapshots/uk/ac/shef/dcs/oak/jate/2.0Alpha-SNAPSHOT/jate-2.0Alpha-20140810.08
0638-1.jar, ReasonPhrase: Forbidden.
        at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(Def
aultArtifactDeployer.java:141)
        at org.sonatype.nexus.maven.staging.deploy.strategy.AbstractDeployStrate
gy.deployUp(AbstractDeployStrategy.java:202)
        at org.sonatype.nexus.maven.staging.deploy.strategy.DeferredDeployStrate
gy.finalizeDeploy(DeferredDeployStrategy.java:86)
        at org.sonatype.nexus.maven.staging.deploy.DeployMojo.execute(DeployMojo
.java:213)
        ... 21 more
Caused by: org.sonatype.aether.deployment.DeploymentException: Failed to deploy
artifacts: Could not transfer artifact uk.ac.shef.dcs.oak:jate:jar:2.0Alpha-2014
0810.080638-1 from/to ossrh (https://oss.sonatype.org/content/repositories/snaps
hots): Access denied to: https://oss.sonatype.org/content/repositories/snapshots
/uk/ac/shef/dcs/oak/jate/2.0Alpha-SNAPSHOT/jate-2.0Alpha-20140810.080638-1.jar,
ReasonPhrase: Forbidden.
        at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeplo
yer.java:280)
        at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeplo
yer.java:211)
        at org.sonatype.aether.impl.internal.DefaultRepositorySystem.deploy(Defa
ultRepositorySystem.java:443)
        at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(Def
aultArtifactDeployer.java:137)
        ... 24 more
Caused by: org.sonatype.aether.transfer.ArtifactTransferException: Could not tra
nsfer artifact uk.ac.shef.dcs.oak:jate:jar:2.0Alpha-20140810.080638-1 from/to os
srh (https://oss.sonatype.org/content/repositories/snapshots): Access denied to:
 https://oss.sonatype.org/content/repositories/snapshots/uk/ac/shef/dcs/oak/jate
/2.0Alpha-SNAPSHOT/jate-2.0Alpha-20140810.080638-1.jar, ReasonPhrase: Forbidden.

        at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(W
agonRepositoryConnector.java:951)
        at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(W
agonRepositoryConnector.java:941)
        at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$PutTask.
run(WagonRepositoryConnector.java:837)
        at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.put(Wago
nRepositoryConnector.java:467)
        at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeplo
yer.java:274)
        ... 27 more
Caused by: org.apache.maven.wagon.authorization.AuthorizationException: Access d
enied to: https://oss.sonatype.org/content/repositories/snapshots/uk/ac/shef/dcs
/oak/jate/2.0Alpha-SNAPSHOT/jate-2.0Alpha-20140810.080638-1.jar, ReasonPhrase: F
orbidden.
        at org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.put(Abstr
actHttpClientWagon.java:618)
        at org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.put(Abstr
actHttpClientWagon.java:524)
        at org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.put(Abstr
actHttpClientWagon.java:505)
        at org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.put(Abstr
actHttpClientWagon.java:485)
        at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$PutTask.
run(WagonRepositoryConnector.java:811)
        ... 29 more
[ERROR]
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception 

1 个答案:

答案 0 :(得分:4)

抱歉,我刚刚意识到我犯了一个愚蠢的错误,我的项目pom文件中的组ID和sonatype存储库中的组ID不匹配。很容易解决,但这是一个愚蠢的错误。