maven deploy-x无法部署工件….访问被拒绝:http://

clj7thdc  于 2021-06-30  发布在  Java
关注(0)|答案(1)|浏览(511)

我试图在我的项目上运行mvndeploy我没有收到任何错误代码,比如401407等等
但是日志上说

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][error][error]有关错误和可能的解决方案的详细信息,请阅读以下文章:[error][help 1]http://cwiki.apache.org/confluence/display/maven/mojoexecutionexception [error][error]更正问题后,可以使用命令[error]mvn-rf:project name three恢复生成
我尝试验证settings.xml和pom分发管理。。由于这不是生成任何错误代码,我无法计算代码的确切问题

kd3sttzy

kd3sttzy1#

根据状态码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>

相关问题