简体   繁体   English

Maven 启动 Quarkus 测试会导致 401 未经授权的错误,当引导程序尝试从 Nexus 存储库获取依赖项时

[英]Maven launch of Quarkus tests causes 401 unauthorized error when bootstrap attempts to get dependencies from Nexus repo

I've just set-up a Jenkins pipeline to test a small Quarkus app.我刚刚设置了一个 Jenkins 管道来测试一个小型 Quarkus 应用程序。 My Jenkins runs in a corporate Kubernetes-based CI/CD environment with corporate Nexus repositories. My Jenkins 在具有企业 Nexus 存储库的基于 Kubernetes 的企业 CI/CD 环境中运行。 The first stage just tries to launch @QuarkusTests (that work locally in my IDE) with:第一阶段只是尝试启动 @QuarkusTests(在我的 IDE 中本地工作):

mvn clean test -Dquarkus.test.profile=xxx

everything seems to build OK, but when the surefire plugin launches the QuarkusTests, the Quarkus bootstrap tries to get dependencies from the Nexus repo and fails with an HTTP 401 error.一切似乎都构建正常,但是当 surefire 插件启动 QuarkusTests 时,Quarkus 引导程序尝试从 Nexus 存储库获取依赖项并失败并出现 HTTP 401 错误。

Caused by: org.apache.maven.model.resolution.UnresolvableModelException: Could not transfer artifact io.quarkus:quarkus-bom:pom:2.15.0.Final from/to shp.mirror (http://<***************>/): authentication failed for http://<***************>/io/quarkus/quarkus-bom/2.15.0.Final/quarkus-bom-2.15.0.Final.pom, status: 401 Unauthorized

Dependencies were collected correctly from Nexus by Maven with no problems up until this stage.在此阶段之前,Maven 已从 Nexus 正确收集依赖项,没有任何问题。

I checked that the Jenkins user was able to reach the dependeny that failed.我检查了 Jenkins 用户是否能够访问失败的依赖项。

Things that I tried:我尝试过的事情:

  • in the surefire maven config, I tried passing the maven config settings from the Jenkins environment, as recommended in the doc (values collected by running mvn -X)在 surefire maven 配置中,我尝试按照文档中的建议从 Jenkins 环境传递 maven 配置设置(通过运行 mvn -X 收集的值)
        <configuration>
          <systemPropertyVariables>
            <maven.home>${maven.home}</maven.home> 
            <maven.repo.local>${settings.localRepository}</maven.repo.local> 
            <maven.settings>${session.request.userSettingsFile.path}</maven.settings> 
            <maven.top-level-basedir>${session.topLevelProject.basedir.absolutePath}</maven.top-level-basedir> 
            <quarkus.bootstrap.effective-model-builder>true</quarkus.bootstrap.effective-model-builder> 
          </systemPropertyVariables>
        </configuration>

  • I also tried creating a link between the default settings location (~/.m2/settings.xml and the one used in the Jenkins environment)我还尝试在默认设置位置(~/.m2/settings.xml 和 Jenkins 环境中使用的位置)之间创建链接
  • I also tried mvn quarkus:go-offline before running the tests, hoping that this would collect everything needed by the Quarkus bootstrap, but it doesn't seems to make any difference在运行测试之前,我还尝试了 mvn quarkus:go-offline,希望这会收集 Quarkus 引导程序所需的一切,但它似乎没有任何区别

Any ideas on what may be causing this error, or on how to collect all the dependencies needed by Quarkus bootstrap would be geatly appreciated.对于可能导致此错误的原因或如何收集 Quarkus 引导程序所需的所有依赖项的任何想法,我们将不胜感激。

Thanks谢谢

Do you have java.net.ssl.* properties set in MAVEN_OPTS as documented in https://maven.apache.org/guides/mini/guide-repository-ssl.html ?您是否按照https://maven.apache.org/guides/mini/guide-repository-ssl.html中的说明在MAVEN_OPTS中设置了java.net.ssl.*属性? If so, they will also need to be propagated to the surefire plugin.如果是这样,它们还需要传播到 surefire 插件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从maven在nexus中部署工件会产生错误返回代码是:401 ReasonPhrase:未经授权 - Deploying artifacts in nexus from maven gives error Return code is: 401 ReasonPhrase: Unauthorized nexus-staging-maven-plugin 401未经授权 - nexus-staging-maven-plugin 401 Unauthorized Maven-错误代码401,未经授权 - Maven - Error code 401, Unauthorized 新的 eclipse 版本无法将 jar 部署到 Nexus 存储库,401 未经授权 - new eclipse version fails to deploy jar to Nexus repo with 401 unauthorized eclipse maven 部署战争到 nexus OSS 访问被拒绝 错误代码 401,未经授权 - eclipse maven deploy war to nexus OSS Access denied Error code 401, Unauthorized 从maven在nexus中部署工件会出现错误“返回代码是:401”? - Deploying artifacts in nexus from maven gives error “Return code is: 401”? 部署 Maven 工件时出现“401 Unauthorized”错误 - Got "401 Unauthorized" error when deploy a maven artifact 现在,当将工件部署到archiva maven repo时,在jenkins中获得401未授权 - now getting 401 unauthorized in jenkins when deploying artifact to archiva maven repo 如何强制Maven从另一个关系存储库获取依赖项 - How to force maven to get dependencies from another nexus repositorie 如何从nexus和本地.m2存储库导入Maven依赖关系? - How to import maven dependencies from nexus and from local .m2 repo?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM