Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExtensionDescriptorMojoTest fails on a pristine computer #37782

Closed
dmlloyd opened this issue Dec 15, 2023 · 8 comments · Fixed by #39089
Closed

ExtensionDescriptorMojoTest fails on a pristine computer #37782

dmlloyd opened this issue Dec 15, 2023 · 8 comments · Fixed by #39089
Assignees
Labels
kind/bug Something isn't working
Milestone

Comments

@dmlloyd
Copy link
Member

dmlloyd commented Dec 15, 2023

Describe the bug

The ExtensionDescriptorMojoTest fails on a pristine system with an error like this:

[ERROR] io.quarkus.maven.ExtensionDescriptorMojoTest.shouldProcessRealisticExtensionCleanly -- Time elapsed: 8.031 s <<< ERROR!
org.apache.maven.plugin.MojoExecutionException: Failed to resolve dependencies of io.quackiverse:quarkus-fake-extension:jar:999-SNAPSHOT
    at io.quarkus.maven.ExtensionDescriptorMojo.resolveRuntimeDeps(ExtensionDescriptorMojo.java:890)
    at io.quarkus.maven.ExtensionDescriptorMojo.validateExtensionDeps(ExtensionDescriptorMojo.java:788)
    at io.quarkus.maven.ExtensionDescriptorMojo.execute(ExtensionDescriptorMojo.java:255)
    at io.quarkus.maven.ExtensionDescriptorMojoTest.shouldProcessRealisticExtensionCleanly(ExtensionDescriptorMojoTest.java:146)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: org.eclipse.aether.resolution.DependencyResolutionException: Failed to collect dependencies at io.quarkus:quarkus-core:jar:2.12.0.Final -> org.jboss.logging:jboss-logging-annotations:jar:2.2.1.Final
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:362)
    at io.quarkus.maven.ExtensionDescriptorMojo.resolveRuntimeDeps(ExtensionDescriptorMojo.java:887)
    ... 6 more
Caused by: org.eclipse.aether.collection.DependencyCollectionException: Failed to collect dependencies at io.quarkus:quarkus-core:jar:2.12.0.Final -> org.jboss.logging:jboss-logging-annotations:jar:2.2.1.Final
    at org.eclipse.aether.internal.impl.collect.DependencyCollectorDelegate.collectDependencies(DependencyCollectorDelegate.java:260)
    at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:87)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:327)
    ... 7 more
Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.jboss.logging:jboss-logging-annotations:jar:2.2.1.Final
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:289)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:175)
    at org.eclipse.aether.internal.impl.collect.df.DfDependencyCollector.resolveCachedArtifactDescriptor(DfDependencyCollector.java:382)
    at org.eclipse.aether.internal.impl.collect.df.DfDependencyCollector.getArtifactDescriptorResult(DfDependencyCollector.java:368)
    at org.eclipse.aether.internal.impl.collect.df.DfDependencyCollector.processDependency(DfDependencyCollector.java:218)
    at org.eclipse.aether.internal.impl.collect.df.DfDependencyCollector.processDependency(DfDependencyCollector.java:156)
    at org.eclipse.aether.internal.impl.collect.df.DfDependencyCollector.process(DfDependencyCollector.java:138)
    at org.eclipse.aether.internal.impl.collect.df.DfDependencyCollector.doRecurse(DfDependencyCollector.java:343)
    at org.eclipse.aether.internal.impl.collect.df.DfDependencyCollector.processDependency(DfDependencyCollector.java:277)
    at org.eclipse.aether.internal.impl.collect.df.DfDependencyCollector.processDependency(DfDependencyCollector.java:156)
    at org.eclipse.aether.internal.impl.collect.df.DfDependencyCollector.process(DfDependencyCollector.java:138)
    at org.eclipse.aether.internal.impl.collect.df.DfDependencyCollector.doCollectDependencies(DfDependencyCollector.java:108)
    at org.eclipse.aether.internal.impl.collect.DependencyCollectorDelegate.collectDependencies(DependencyCollectorDelegate.java:222)
    ... 9 more
Caused by: org.apache.maven.model.resolution.UnresolvableModelException: The following artifacts could not be resolved: org.jboss:jboss-parent:pom:34 (present, but unavailable): Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact org.jboss:jboss-parent:pom:34 has not been downloaded from it before.
    at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:160)
    at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:204)
    at org.apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultModelBuilder.java:1009)
    at org.apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.java:801)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:327)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:243)
    at io.quarkus.bootstrap.resolver.maven.MavenModelBuilder.build(MavenModelBuilder.java:63)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:284)
    ... 21 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: The following artifacts could not be resolved: org.jboss:jboss-parent:pom:34 (present, but unavailable): Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact org.jboss:jboss-parent:pom:34 has not been downloaded from it before.
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:459)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:259)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:242)
    at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:158)
    ... 28 more
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact org.jboss:jboss-parent:pom:34 has not been downloaded from it before.
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:410)
    ... 31 more
Caused by: org.eclipse.aether.transfer.RepositoryOfflineException: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode
    at org.eclipse.aether.internal.impl.DefaultOfflineController.checkOffline(DefaultOfflineController.java:59)
    at org.eclipse.aether.internal.impl.Utils.checkOffline(Utils.java:106)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:404)
    ... 31 more

As a workaround, set the io.quarkus.maven.ExtensionDescriptorMojoTest#RESOLVE_OFFLINE field to false and re-run the tests in independent-projects/extension-maven-plugin. After the tests pass, the field can be reverted as the test will continue to pass from now on.

Expected behavior

The test should pass.

Actual behavior

The test fails with the aforementioned exception.

How to Reproduce?

  1. Start with a pristine system. It may be enough to drop ~/.m2/repository but I haven't been brave enough to try it.
  2. Build Quarkus, including this test.
  3. Observe failure.

Output of uname -a or ver

Darwin xxxx 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct 9 21:28:45 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6020 arm64

Output of java -version

openjdk version "17.0.9" 2023-10-17 OpenJDK Runtime Environment Temurin-17.0.9+9 (build 17.0.9+9) OpenJDK 64-Bit Server VM Temurin-17.0.9+9 (build 17.0.9+9, mixed mode)

Quarkus version or git rev

0d90b7c

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

Apache Maven 3.9.5 (57804ffe001d7215b5e7bcb531cf83df38f93546) Maven home: /Users/david/local/apache-maven Java version: 17.0.9, vendor: Eclipse Adoptium, runtime: /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "14.1.2", arch: "aarch64", family: "mac"

Additional information

No response

@dmlloyd dmlloyd added the kind/bug Something isn't working label Dec 15, 2023
@geoand
Copy link
Contributor

geoand commented Dec 18, 2023

cc @holly-cummins

@holly-cummins
Copy link
Contributor

It looks like the root issue is that we need to have downloaded org.jboss:jboss-parent:pom:34 before this test runs. I wonder if adding it to the pom would do the trick. Or perhaps the issue is that a parent pom version is hardcoded in the test file (@aloubyansky is always telling me not to do that :) ) and it has gone out of sync with what gets downloaded elsewhere in the build.

@aloubyansky
Copy link
Member

For tests like this failing one that resolves dependencies of an older (and outside the main project) Quarkus version we should disable offline mode. That would mean probably adding an argument to makeMojo(dirName) , such as offline and initialize the Maven artifact resolver accordingly.

@holly-cummins
Copy link
Contributor

I couldn’t easily reproduce this; deleting my Maven repository, running a top level build with -Dquickly, and then running mvn -f independent-projects/extension-maven-plugin/ clean verify wasn’t enough. I guess something earlier in the -Dquickly path brings in the problem dependencies. I didn’t want to run a full build, so I tried building just the projects I needed, but after a few attempts of trying to find a minimal sequence, I gave up.

This would also explain why the test doesn’t fail in the CI; something built after independent-projects must have the dependency the tests need, so it’s getting into the GitHub maven cache that way.

I've gone with @aloubyansky's suggested fix, and just allowed the test projects to be resolved online if they need it.

@dmlloyd
Copy link
Member Author

dmlloyd commented Feb 29, 2024

I did reproduce this just today (I didn't use -Dquickly, maybe that's the key; it didn't take very long to hit the problem on my M2 despite that). I think I may be able to test the proposed fix after a meeting this morning. Thanks!

@aloubyansky
Copy link
Member

Right, it's failing during "validation of extension dependencies", which is disabled in the "quickly" profile

@holly-cummins
Copy link
Contributor

Right, it's failing during "validation of extension dependencies", which is disabled in the "quickly" profile

I wasn't expecting it to fail with quickly, I was just using quickly to warm my empty maven repository, so that I could run verify in the extension-maven-plugin project. But quickly warms the repository too much, and the extension-maven-plugin verify passes.

@quarkus-bot quarkus-bot bot added this to the 3.9 - main milestone Mar 1, 2024
@dmlloyd
Copy link
Member Author

dmlloyd commented Mar 1, 2024

Just want to say that the fix seems to have worked. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants