当前位置: 首页 > 面试题库 >

现在在将工件部署到Archiva Maven回购协议时,Jenkins遭到未经授权的401

萧波峻
2023-03-14
问题内容

在我将詹金斯(Jenkins)升级到1.494之前,这种方法一直有效。现在,在使用构建升级插件将war工件复制到快照存储库时,我在Jenkins中收到此错误:

    ERROR: Failed to deploy artifacts: Could not transfer artifact com.blah.data:RestWebServices:war:1.0-20121224.163825-2 from/to archiva.apache.snapshots (http://10.31.31.64:8080/archiva/repository/snapshots): Failed to transfer file: http://10.31.31.64:8080/archiva/repository/snapshots/com/blah/data/RestWebServices/1.0-SNAPSHOT/RestWebServices-1.0-20121224.163825-2.war. Return code is: 401, ReasonPhrase:Unauthorized.
org.apache.maven.artifact.deployer.ArtifactDeploymentException: Failed to deploy artifacts: Could not transfer artifact com.blah.data:RestWebServices:war:1.0-20121224.163825-2 from/to archiva.apache.snapshots (http://10.31.31.64:8080/archiva/repository/snapshots): Failed to transfer file: http://10.31.31.64:8080/archiva/repository/snapshots/com/blah/data/RestWebServices/1.0-SNAPSHOT/RestWebServices-1.0-20121224.163825-2.war. Return code is: 401, ReasonPhrase:Unauthorized.
    at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:141)
    at hudson.maven.reporters.MavenArtifactRecord.deploy(MavenArtifactRecord.java:190)
    at hudson.maven.RedeployPublisher.perform(RedeployPublisher.java:173)
    at hudson.plugins.promoted_builds.Promotion$RunnerImpl.build(Promotion.java:187)
    at hudson.plugins.promoted_builds.Promotion$RunnerImpl.doRun(Promotion.java:141)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:586)
    at hudson.model.Run.execute(Run.java:1543)
    at hudson.model.Run.run(Run.java:1489)
    at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:106)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:236)
Caused by: org.sonatype.aether.deployment.DeploymentException: Failed to deploy artifacts: Could not transfer artifact com.blah.data:RestWebServices:war:1.0-20121224.163825-2 from/to archiva.apache.snapshots (http://10.31.31.64:8080/archiva/repository/snapshots): Failed to transfer file: http://10.31.31.64:8080/archiva/repository/snapshots/com/blah/data/RestWebServices/1.0-SNAPSHOT/RestWebServices-1.0-20121224.163825-2.war. Return code is: 401, ReasonPhrase:Unauthorized.
    at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeployer.java:280)
    at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeployer.java:211)
    at org.sonatype.aether.impl.internal.DefaultRepositorySystem.deploy(DefaultRepositorySystem.java:443)
    at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:137)
    ... 10 more
Caused by: org.sonatype.aether.transfer.ArtifactTransferException: Could not transfer artifact com.blah.data:RestWebServices:war:1.0-20121224.163825-2 from/to archiva.apache.snapshots (http://10.31.31.64:8080/archiva/repository/snapshots): Failed to transfer file: http://10.31.31.64:8080/archiva/repository/snapshots/com/blah/data/RestWebServices/1.0-SNAPSHOT/RestWebServices-1.0-20121224.163825-2.war. Return code is: 401, ReasonPhrase:Unauthorized.
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:951)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:941)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$PutTask.run(WagonRepositoryConnector.java:837)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.put(WagonRepositoryConnector.java:467)
    at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeployer.java:274)
    ... 13 more
Caused by: org.apache.maven.wagon.TransferFailedException: Failed to transfer file: http://10.31.31.64:8080/archiva/repository/snapshots/com/blah/data/RestWebServices/1.0-SNAPSHOT/RestWebServices-1.0-20121224.163825-2.war. Return code is: 401, ReasonPhrase:Unauthorized.
    at org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.put(AbstractHttpClientWagon.java:613)
    at org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.put(AbstractHttpClientWagon.java:509)
    at org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.put(AbstractHttpClientWagon.java:490)
    at org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.put(AbstractHttpClientWagon.java:470)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$PutTask.run(WagonRepositoryConnector.java:811)
    ... 15 more

我在settings.xml文件中有信誉:

<server>
      <id>snapshots</id>
      <username>deployment</username>
      <password>deployment</password>
    </server>

不知道为什么突然停止使用1.494。我逐步降级至1.491,但这种情况仍然存在。非常沮丧。


问题答案:

我想出了解决问题的方法,但是我仍然不知道它是如何发生的。

我在Archiva中创建了第3个用户,并对其进行了设置,以便该用户不必在第一次登录时更改密码。然后,我使用该新用户更新了Jenkins中的settings.xml。

现在可以使用了。

我仍然不知道为什么它停止与原始用户一起工作。

感谢大家的帮助。



 类似资料:
  • 在我将Jenkins升级到1.494之前,这是可行的。现在,当我在Jenkins中使用构建提升插件将war工件复制到快照repo时,我得到了这个错误: 不知道为什么这突然停止了1.494的工作。我逐渐降级到1.491,但它仍然发生了。非常令人沮丧。

  • 我有一个Quarkus项目,它公开了一些RESTendpoint。当在开发模式下工作或从本地构建docker容器中运行时,所有工作都很好,那些用@rolesalloved和@permitall注释的endpoint都正常工作。但是当我按照以下步骤部署到AWS服务时: 提交到Gitlab 运行Gitlab cicd 将结果与配置一起发送到AWS S3 bucket 触发AWS CodePipelin

  • 我最近开始使用eclipse 2021-12。当我尝试将jar部署到我们的Nexus存储库时,它失败了,引用了“部署工件失败:无法传输工件......”和“访问被拒绝......”,以及“错误代码401,未经授权”。我和我的运营模式团队仔细检查了所有设置,一切看起来都很好(我们确认了settings.xml凭据是正确的)。 我试图使用eclipse 2021-06部署同一个罐子...它起作用了!我

  • 未能执行goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy(default-deploy)on project time-demo-api:未能部署工件:无法将工件com.mycompany:time-demo-api:pom:1.0.1-20210503.122407-1从/到快照(http://localhost:808

  • 当处理webhook时,我得到一个未经授权的401,我使用Spring Security和Vaadin 和 我知道我需要公开我的endpoint /通知 如何公开endpoint? 已更新 引发消息 2022-06-10 17:39:30.040WARN 37089 --- [ restartedMain]ConfigServletWebServerApplication Context:在上下文

  • 我的名为“TestProject”的Java/Maven项目与我的jenkins and nexus repo挂钩: 我的pom.xml看起来是: 正如预期的那样,jenkins将工件上传到Nexus,看看jenkins build的控制台输出,如下所示: 问题是: 如果我在pom.xml中指定的版本是