简体   繁体   中英

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. My Jenkins runs in a corporate Kubernetes-based CI/CD environment with corporate Nexus repositories. The first stage just tries to launch @QuarkusTests (that work locally in my IDE) with:

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.

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.

I checked that the Jenkins user was able to reach the dependeny that failed.

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)
        <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)
  • 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

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.

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 ? If so, they will also need to be propagated to the surefire plugin.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM