Maven deploy -x导致无法部署工件....拒绝访问:http://

时间:2018-12-07 04:44:13

标签: java maven nexus snapshot maven-deploy-plugin

我正在尝试在项目上运行mvn deploy 我没有收到任何错误代码,例如401,407等

但是日志在说

Uploading to repo id: dav:http://snapshot repo link//parent-pom/2.0.0.

然后执行失败

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] parent-pom 2.0.0-SNAPSHOT ........... SUCCESS [  9.264 s]
[INFO] project-name-one .................. SUCCESS [  8.086 s]
[INFO] project-name-two ..................... SUCCESS [ 37.332 s]
[INFO] project-name-three ...................... SUCCESS [ 20.625 s]
[INFO] project-name-four 2.0.0-SNAPSHOT ... FAILURE [ 19.265 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:35 min
[INFO] Finished at: 2018-12-06T21:55:07-06:00
[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project project-name-four: Failed to deploy artifacts: Could not transfer artifact project.groupid:project-name-one:pom:2.0.0-20181207.035505-1 from/to [repo id] (dav:http://repo/main/snapshot-repo): Access denied to: http://repo/main/snapshot-repo/project/group/id/project-name-one/2.0.0-SNAPSHOT/project-name-one-2.0.0-20181207.035505-1.pom -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project project-name-four: Failed todeploy artifacts: Could not transfer artifact project.groupid:project-name-one:pom:2.0.0-20181207.035505-1 from/to [repo id] (dav:http://repo/main/snapshot-repo): Access denied to: http://repo/main/snapshot-repo/project/group/id/project-name-one/2.0.0-SNAPSHOT/project-name-one-2.0.0-20181207.035505-1.pom
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to deploy artifacts: Could not transfer artifact project.groupid:project-name-one:pom:2.0.0-20181207.035505-1 from/to [repo id] (dav:http://repo/main/snapshot-repo): Access denied to: http://repo/main/snapshot-repo/project/group/id/project-name-one/2.0.0-SNAPSHOT/project-name-one-2.0.0-20181207.035505-1.pom
    at org.apache.maven.plugin.deploy.DeployMojo.deployProject (DeployMojo.java:284)
    at org.apache.maven.plugin.deploy.DeployMojo.execute (DeployMojo.java:185)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.artifact.deployer.ArtifactDeploymentException: Failed to deploy artifacts: Could not transfer artifact project.groupid:project-name-one:pom:2.0.0-20181207.035505-1 from/to [repo id] (dav:http://repo/main/snapshot-repo): Access denied to: http://repo/main/snapshot-repo/project/group/id/project-name-one/2.0.0-SNAPSHOT/project-name-one-2.0.0-20181207.035505-1.pom
    at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy (DefaultArtifactDeployer.java:146)
    at org.apache.maven.plugin.deploy.AbstractDeployMojo.deploy (AbstractDeployMojo.java:171)
    at org.apache.maven.plugin.deploy.DeployMojo.deployProject (DeployMojo.java:242)
    at org.apache.maven.plugin.deploy.DeployMojo.execute (DeployMojo.java:185)
.
.
.
.

Caused by: org.eclipse.aether.deployment.DeploymentException: Failed to deploy artifacts: Could not transfer artifact project.groupid:project-name-one:pom:2.0.0-20181207.035505-1 from/to [repo id] (dav:http://repo/main/snapshot-repo): Access denied to: http://repo/main/snapshot-repo/project/group/id/project-name-one/2.0.0-SNAPSHOT/project-name-one-2.0.0-20181207.035505-1.pom
    at org.eclipse.aether.internal.impl.DefaultDeployer.deploy (DefaultDeployer.java:295)
    at org.eclipse.aether.internal.impl.DefaultDeployer.deploy (DefaultDeployer.java:223)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.deploy (DefaultRepositorySystem.java:384)
    at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy (DefaultArtifactDeployer.java:142)
    at org.apache.maven.plugin.deploy.AbstractDeployMojo.deploy (AbstractDeployMojo.java:171)
    at org.apache.maven.plugin.deploy.DeployMojo.deployProject (DeployMojo.java:242)
.
.
.
.

Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact project.groupid:project-name-one:pom:2.0.0-20181207.035505-1 from/to [repo id] (dav:http://repo/main/snapshot-repo): Access denied to: http://repo/main/snapshot-repo/project/group/id/project-name-one/2.0.0-SNAPSHOT/project-name-one-2.0.0-20181207.035505-1.pom
    at org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed (ArtifactTransportListener.java:52)
    at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run (BasicRepositoryConnector.java:365)
    at org.eclipse.aether.connector.basic.BasicRepositoryConnector.put (BasicRepositoryConnector.java:284)
    at org.eclipse.aether.internal.impl.DefaultDeployer.deploy (DefaultDeployer.java:289)
.
.
.
.
Caused by: org.apache.maven.wagon.authorization.AuthorizationException: Access denied to: http://repo/main/snapshot-repo/project/group/id/project-name-one/2.0.0-SNAPSHOT/project-name-one-2.0.0-20181207.035505-1.pom
    at org.apache.maven.wagon.shared.http.AbstractHttpClientWagon.put (AbstractHttpClientWagon.java:409)
    at org.apache.maven.wagon.shared.http.AbstractHttpClientWagon.put (AbstractHttpClientWagon.java:336)
    at org.apache.maven.wagon.shared.http.AbstractHttpClientWagon.put (AbstractHttpClientWagon.java:303)

。    。    。    。     [错误]     [错误]     [ERROR]有关错误和可能的解决方案的详细信息,请阅读以下文章:     [错误] [帮助1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException     [错误]     [错误]纠正问题后,您可以使用以下命令恢复构建     [错误] mvn -rf:项目名称三

我试图验证settings.xml和pom分发管理。 由于这不会生成任何错误代码,因此我无法计算出确切的问题

1 个答案:

答案 0 :(得分:1)

基于状态码401和407,可能发生两种情况之一。在401的情况下,工件服务器(Nexus)需要授权和身份验证才能发布工件。在这种情况下,您需要提供所需的用户名和密码。可以在〜/ .m2 / settings.xml中添加类似以下内容来完成此操作:

<servers>
  <server>
    <id>dav:http://snapshot</div>
    <username>youruser</username>
    <password>yourpass</password>
  </server>
</servers

错误代码407表示完全不同的问题。这通常意味着您和需要登录的工件服务器之间有一个代理服务器。通常可以通过使用所需的用户名和密码将代理配置添加到settings.xml中来解决。参见下面的示例以获取模板。

<proxies>
    <!-- proxy
 | Specification for one proxy, to be used in connecting to the network.
 |
<proxy>
  <id>optional</id>
  <active>true</active>
  <protocol>http</protocol>
  <username>proxyuser</username>
  <password>proxypass</password>
  <host>proxy.host.net</host>
  <port>80</port>
  <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
-->
</proxies>