quarkus: Dependencies error when building tests only on gitlab ci pipeline (non native)

Describe the bug

@aloubyansky

When the gitlab ci pipeline runs the tests i am getting dependency resolutions errors.

Caused by: io.quarkus.bootstrap.BootstrapException: Failed to create the application model for com.mycompany.mypackage:myservice-svc::jar:1.0.0-SNAPSHOT
Caused by: io.quarkus.bootstrap.resolver.maven.BootstrapMavenException: Failed to resolve dependencies for com.mycompany.mypackage:myservice-svc:jar:1.0.0-SNAPSHOT
Caused by: org.eclipse.aether.resolution.DependencyResolutionException: The following artifacts could not be resolved: com.mycompany.mypackage:myservice-api:yaml:1.0.0-SNAPSHOT, com.mycompany.mypackage:myservice-api:json:1.0.0-SNAPSHOT, com.mycompany.mypackage:myservice-api:yaml:async:1.0.0-SNAPSHOT, com.mycompany.mypackage:myservice-api:json:async:1.0.0-SNAPSHOT: Could not find artifact com.mycompany.mypackage:myservice-api:yaml:1.0.0-SNAPSHOT
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: The following artifacts could not be resolved: com.mycompany.mypackage:myservice-api:yaml:1.0.0-SNAPSHOT, com.mycompany.mypackage:myservice-api:json:1.0.0-SNAPSHOT, com.mycompany.mypackage:myservice-api:yaml:async:1.0.0-SNAPSHOT, com.mycompany.mypackage:myservice-api:json:async:1.0.0-SNAPSHOT: Could not find artifact com.mycompany.mypackage:myservice-api:yaml:1.0.0-SNAPSHOT
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact com.mycompany.mypackage:myservice-api:yaml:1.0.0-SNAPSHOT
132924 [INFO] Running com.mycompany.mypackage.MyFailingTest

I can see the artifacts being deployed in the log previously, in the local repo:

6991 [INFO] --- maven-install-plugin:2.4:install (default-install) @ myservice-api ---
6999 [INFO] Installing somelocation/myservice/api/target/myservice-api-1.0.0-SNAPSHOT.jar to somelocation/myservice/.m2/repository/namespace/myservice-api/1.0.0-SNAPSHOT/myservice-api-1.0.0-SNAPSHOT.jar
7010 [INFO] Installing somelocation/myservice/api/pom.xml to somelocation/myservice/.m2/repository/namespace/myservice-api/1.0.0-SNAPSHOT/myservice-api-1.0.0-SNAPSHOT.pom
7022 [INFO] Installing somelocation/myservice/api/target/generated-sources/async-openapi/openapi/openapi.yaml to somelocation/myservice/.m2/repository/namespace/myservice-api/1.0.0-SNAPSHOT/myservice-api-1.0.0-SNAPSHOT-async.yaml
7033 [INFO] Installing somelocation/myservice/api/target/generated-sources/async-openapi/openapi.json to somelocation/myservice/.m2/repository/namespace/myservice-api/1.0.0-SNAPSHOT/myservice-api-1.0.0-SNAPSHOT-async.json
7044 [INFO] Installing somelocation/myservice/api/target/generated-sources/sync-openapi/openapi/openapi.yaml to somelocation/myservice/.m2/repository/namespace/myservice-api/1.0.0-SNAPSHOT/myservice-api-1.0.0-SNAPSHOT.yaml
7055 [INFO] Installing somelocation/myservice/api/target/generated-sources/sync-openapi/openapi.json to somelocation/myservice/.m2/repository/namespace/myservice-api/1.0.0-SNAPSHOT/myservice-api-1.0.0-SNAPSHOT.json

The gitlab command is:

mvn $MAVEN_CLI_OPTS clean install -DinstallAtEnd=true -DdeployAtEnd=true;
MAVEN_CLI_OPTS=--batch-mode --errors --fail-at-end --show-version -Dmaven.repo.local=.m2/repository -DinstallAtEnd=true -DdeployAtEnd=true --settings $MAVEN_SETTINGS_PATH/$MAVEN_SETTINGS.xml"
MAVEN_SETTINGS_PATH: "/maven-tools"
MAVEN_SETTINGS: "jenkins-settings"

my pom.xml:

        <dependency>
            <groupId>com.mycompany.mypackage</groupId>
            <artifactId>myservice-api</artifactId>
            <version>1.0.0-SNAPSHOT</version>
            <type>yaml</type>
        </dependency>
        <dependency>
            <groupId>com.mycompany.mypackage</groupId>
            <artifactId>myservice-api</artifactId>
            <version>1.0.0-SNAPSHOT</version>
            <type>json</type>
        </dependency>
        <dependency>
            <groupId>com.mycompany.mypackage</groupId>
            <artifactId>myservice-api</artifactId>
            <version>1.0.0-SNAPSHOT</version>
            <classifier>async</classifier>
            <type>yaml</type>
        </dependency>
        <dependency>
            <groupId>com.mycompany.mypackage</groupId>
            <artifactId>myservice-api</artifactId>
            <version>1.0.0-SNAPSHOT</version>
            <classifier>async</classifier>
            <type>json</type>
        </dependency>

then

  <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${compiler-plugin.version}</version>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${surefire-plugin.version}</version>
                <configuration>
                    <systemPropertyVariables>
                        <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                        <maven.home>${maven.home}</maven.home>
                        <maven.settings>${session.request.userSettingsFile.path}</maven.settings>
                    </systemPropertyVariables>
                </configuration>
            </plugin>`

My maven settings contain references to private repos. Nothing special there. The dependencies are deployed on the local maven folder for the build. Also, on local of course, everything works perfectly. I tried to reproduce the same versions and command lines from gitlab to no avail. Another point, if i have no tests to run, the build passes on gitlab without issues.

What i tried from other issues found on github:

  • making sure to use hardcoded versions (no variables) for the dependencies in question.
  • Adding the userSettingsFile line as above
  • doing first in the pipeline:
    mvn $MAVEN_CLI_OPTS dependency:resolve; mvn $MAVEN_CLI_OPTS compile -DskipTests;
  • trying different versions of the surefire plugin (now i use 3.0.0-M5)

Expected behavior

The pipeline should pass as it passes on local.

Actual behavior

the build fails with

Caused by: io.quarkus.bootstrap.BootstrapException: Failed to create the application model for com.mycompany.mypackage:myservice-svc::jar:1.0.0-SNAPSHOT
Caused by: io.quarkus.bootstrap.resolver.maven.BootstrapMavenException: Failed to resolve dependencies for com.mycompany.mypackage:myservice-svc:jar:1.0.0-SNAPSHOT
Caused by: org.eclipse.aether.resolution.DependencyResolutionException: The following artifacts could not be resolved: com.mycompany.mypackage:myservice-api:yaml:1.0.0-SNAPSHOT, com.mycompany.mypackage:myservice-api:json:1.0.0-SNAPSHOT, com.mycompany.mypackage:myservice-api:yaml:async:1.0.0-SNAPSHOT, com.mycompany.mypackage:myservice-api:json:async:1.0.0-SNAPSHOT: Could not find artifact com.mycompany.mypackage:myservice-api:yaml:1.0.0-SNAPSHOT
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: The following artifacts could not be resolved: com.mycompany.mypackage:myservice-api:yaml:1.0.0-SNAPSHOT, com.mycompany.mypackage:myservice-api:json:1.0.0-SNAPSHOT, com.mycompany.mypackage:myservice-api:yaml:async:1.0.0-SNAPSHOT, com.mycompany.mypackage:myservice-api:json:async:1.0.0-SNAPSHOT: Could not find artifact com.mycompany.mypackage:myservice-api:yaml:1.0.0-SNAPSHOT
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact com.mycompany.mypackage:myservice-api:yaml:1.0.0-SNAPSHOT
132924 [INFO] Running com.mycompany.mypackage.MyFailingTest

How to Reproduce?

Add a test and run it on the gitlab ci

Output of uname -a or ver

OS name: “linux”, version: “5.4.0-1056-aws”, arch: “amd64”, family: “unix”

Output of java -version

Java version: 11.0.5, vendor: Oracle Corporation, runtime: /usr/local/openjdk-11

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.1.4.Final

Build tool (ie. output of mvnw --version or gradlew --version)

3.6.2

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 33 (13 by maintainers)

Most upvoted comments

Thanks for the info so far. Just in case, would you be able to test a custom Quarkus branch to debug the issue?

Sure.