GoogleCloudPlatform / artifact-registry-maven-tools

Apache License 2.0
24 stars 22 forks source link

maven does not use artifactregistry-maven-wagon to fetch plugins, in some cases #48

Closed JohanLorenzo closed 3 years ago

JohanLorenzo commented 3 years ago

Hello there!

Thank you for making this maven wagon plugin! We at @maltcommunity have been testing it out for a couple of months and we're quite happy with it! During our tests we stumbled upon a bug that prevents us from switching over to artifact registry. We host some plugins there and in some cases, maven always fails to load the right Wagon.

Steps to reproduce

  1. Clone https://github.com/JohanLorenzo/artifact-registry-maven-tools-issue-48 and cd to the directory. You need either to get access to the artifact registry repo I used for this case, or you could create your own and upload this plugin https://github.com/eclipse/jetty.project/tree/jetty-10.0.5/jetty-jspc-maven-plugin
  2. mvn --errors clean flatten:flatten install --settings settings.xml

Expected results

Maven downloads the plugin with the Artifact registry wagon.

Actual results

[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[WARNING] Failed to retrieve plugin descriptor for some.groupId:jetty-jspc-maven-plugin:10.0.5: Plugin some.groupId:jetty-jspc-maven-plugin:10.0.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for some.groupId:jetty-jspc-maven-plugin:jar:10.0.5
[WARNING] Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to artifact-registry (artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48): Cannot access artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48 with type default using the available connector factories: BasicRepositoryConnectorFactory
[WARNING] Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to artifact-registry (artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48): Cannot access artifa
ctregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48 with type default using the available connector factories: BasicRepositoryConnectorFactory
[WARNING] Could not transfer metadata org.codehaus.mojo:flatten-maven-plugin/maven-metadata.xml from/to artifact-registry (artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48): Cannot access artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48 with type default using the available connector factories: BasicRepositoryConnectorFactory
[INFO]
[INFO] --------------------< some.groupId:some.artifactId >--------------------
[INFO] Building some.artifactId 1.0.0
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] Failed to retrieve plugin descriptor for some.groupId:jetty-jspc-maven-plugin:10.0.5: Plugin some.groupId:jetty-jspc-maven-plugin:10.0.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for some.groupId:jetty-jspc-maven-plugin:jar:10.0.5
[WARNING] org.apache.maven.plugins/maven-metadata.xmlfailed to transfer from artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48 during a previous attempt. This failure was cached in the local repository and resolution will not be reattempted until the update interval of artifact-registry has elapsed or updates are forced. Original error: Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to artifact-registry (artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48): Cannot access artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48 with type default using the available connector factories: BasicRepositoryConnectorFactory
[WARNING] org.codehaus.mojo/maven-metadata.xmlfailed to transfer from artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48 during a previous attempt. This failure was cached in the local repository and resolution will not be reattempted until the update interval of artifact-registry has elapsed or updates are forced. Original error: Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to artifact-registry (artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48): Cannot access artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48 with type default using the available connector factories: BasicRepositoryConnectorFactory
[WARNING] org.codehaus.mojo:flatten-maven-plugin/maven-metadata.xmlfailed to transfer from artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48 during a previous attempt. This failure was cached in the local repository and resolution will not be reattempted until the update interval of artifact-registry has elapsed or updates are forced. Original error: Could not transfer metadata org.codehaus.mojo:flatten-maven-plugin/maven-metadata.xml from/to artifact-registry (artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48): Cannot access artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48 with type default using the available connector factories: BasicRepositoryConnectorFactory
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.456 s
[INFO] Finished at: 2021-07-02T17:53:23+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin some.groupId:jetty-jspc-maven-plugin:10.0.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for some.groupId:jetty-jspc-maven-plugin:jar:10.0.5: some.groupId:jetty-jspc-maven-plugin:pom:10.0.5 failed to transfer from artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of artifact-registry has elapsed or updates are forced. Original error: Could not transfer artifact some.groupId:jetty-jspc-maven-plugin:pom:10.0.5 from/to artifact-registry (artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48): Cannot access artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48 with type default using the available connector factories: BasicRepositoryConnectorFactory -> [Help 1]
org.apache.maven.plugin.PluginResolutionException: Plugin some.groupId:jetty-jspc-maven-plugin:10.0.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for some.groupId:jetty-jspc-maven-plugin:jar:10.0.5
    at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve (DefaultPluginDependenciesResolver.java:120)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor (DefaultMavenPluginManager.java:182)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor (DefaultMavenPluginManager.java:286)
    at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor (DefaultBuildPluginManager.java:244)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecution (DefaultLifecycleExecutionPlanCalculator.java:169)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecutions (DefaultLifecycleExecutionPlanCalculator.java:154)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan (DefaultLifecycleExecutionPlanCalculator.java:130)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan (DefaultLifecycleExecutionPlanCalculator.java:144)
    at org.apache.maven.lifecycle.internal.builder.BuilderCommon.resolveBuildPlan (BuilderCommon.java:97)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:111)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for some.groupId:jetty-jspc-maven-plugin:jar:10.0.5
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom (DefaultArtifactDescriptorReader.java:255)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor (DefaultArtifactDescriptorReader.java:171)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor (DefaultRepositorySystem.java:255)
    at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve (DefaultPluginDependenciesResolver.java:106)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor (DefaultMavenPluginManager.java:182)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor (DefaultMavenPluginManager.java:286)
    at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor (DefaultBuildPluginManager.java:244)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecution (DefaultLifecycleExecutionPlanCalculator.java:169)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecutions (DefaultLifecycleExecutionPlanCalculator.java:154)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan (DefaultLifecycleExecutionPlanCalculator.java:130)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan (DefaultLifecycleExecutionPlanCalculator.java:144)
    at org.apache.maven.lifecycle.internal.builder.BuilderCommon.resolveBuildPlan (BuilderCommon.java:97)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:111)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: some.groupId:jetty-jspc-maven-plugin:pom:10.0.5 failed to transfer from artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of artifact-registry has elapsed or updates are forced. Original error: Could not transfer artifact some.groupId:jetty-jspc-maven-plugin:pom:10.0.5 from/to artifact-registry (artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48): Cannot access artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48 with type default using the available connector factories: BasicRepositoryConnectorFactory
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve (DefaultArtifactResolver.java:424)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts (DefaultArtifactResolver.java:229)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact (DefaultArtifactResolver.java:207)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom (DefaultArtifactDescriptorReader.java:240)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor (DefaultArtifactDescriptorReader.java:171)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor (DefaultRepositorySystem.java:255)
    at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve (DefaultPluginDependenciesResolver.java:106)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor (DefaultMavenPluginManager.java:182)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor (DefaultMavenPluginManager.java:286)
    at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor (DefaultBuildPluginManager.java:244)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecution (DefaultLifecycleExecutionPlanCalculator.java:169)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecutions (DefaultLifecycleExecutionPlanCalculator.java:154)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan (DefaultLifecycleExecutionPlanCalculator.java:130)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan (DefaultLifecycleExecutionPlanCalculator.java:144)
    at org.apache.maven.lifecycle.internal.builder.BuilderCommon.resolveBuildPlan (BuilderCommon.java:97)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:111)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: some.groupId:jetty-jspc-maven-plugin:pom:10.0.5 failed to transfer from artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of artifact-registry has elapsed or updates are forced. Original error: Could not transfer artifact some.groupId:jetty-jspc-maven-plugin:pom:10.0.5 from/to artifact-registry (artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48): Cannot access artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48 with type default using the available connector factories: BasicRepositoryConnectorFactory
    at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException (DefaultUpdateCheckManager.java:225)
    at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.checkArtifact (DefaultUpdateCheckManager.java:169)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.gatherDownloads (DefaultArtifactResolver.java:573)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads (DefaultArtifactResolver.java:483)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve (DefaultArtifactResolver.java:401)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts (DefaultArtifactResolver.java:229)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact (DefaultArtifactResolver.java:207)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom (DefaultArtifactDescriptorReader.java:240)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor (DefaultArtifactDescriptorReader.java:171)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor (DefaultRepositorySystem.java:255)
    at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve (DefaultPluginDependenciesResolver.java:106)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor (DefaultMavenPluginManager.java:182)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor (DefaultMavenPluginManager.java:286)
    at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor (DefaultBuildPluginManager.java:244)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecution (DefaultLifecycleExecutionPlanCalculator.java:169)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecutions (DefaultLifecycleExecutionPlanCalculator.java:154)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan (DefaultLifecycleExecutionPlanCalculator.java:130)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan (DefaultLifecycleExecutionPlanCalculator.java:144)
    at org.apache.maven.lifecycle.internal.builder.BuilderCommon.resolveBuildPlan (BuilderCommon.java:97)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:111)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

Potential root cause

It seems maven doesn't load the wagon at the right time. Altough, in this very case, it works if we don't run the flatten phase: mvn --errors clean install --settings settings.xml

[INFO] --------------------< some.groupId:some.artifactId >--------------------
[INFO] Building some.artifactId 1.0.0
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from artifact-registry: artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48/some/groupId/jetty-jspc-maven-plugin/10.0.5/jetty-jspc-maven-plugin-10.0.5.pom
[INFO] ArtifactRegistry Maven Wagon: Retrieving credentials...
[INFO] Trying Application Default Credentials...
Jul 02, 2021 6:00:22 PM com.google.auth.oauth2.DefaultCredentialsProvider warnAboutProblematicCredentials
WARNING: Your application has authenticated using end user credentials from Google Cloud SDK. We recommend that most server applications use service accounts instead. If your application continues to use end user credentials from Cloud SDK, you might receive a "quota exceeded" or "API not enabled" error. For more information about service accounts, see https://cloud.google.com/docs/authentication/.
[INFO] Using Application Default Credentials.
Downloaded from artifact-registry: artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48/some/groupId/jetty-jspc-maven-plugin/10.0.5/jetty-jspc-maven-plugin-10.0.5.pom (5.0 kB at 7.1 kB/s)
Downloading from artifact-registry: artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48/some/groupId/jetty-jspc-maven-plugin/10.0.5/jetty-jspc-maven-plugin-10.0.5.jar
[INFO] ArtifactRegistry Maven Wagon: Retrieving credentials...
[INFO] Trying Application Default Credentials...
[INFO] Using Application Default Credentials.
Downloaded from artifact-registry: artifactregistry://europe-west1-maven.pkg.dev/malt-build/artifact-registry-maven-tools-issue-48/some/groupId/jetty-jspc-maven-plugin/10.0.5/jetty-jspc-maven-plugin-10.0.5.jar (30 kB at 180 kB/s)

What do you all think, @Gridasov @lindsayismith ?

Additional data

Repro rate: 5 out of 5 times, with this very example. Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) Java version: 11.0.11, vendor: AdoptOpenJDK

Gridasov commented 3 years ago

Hi Johan,

Please add the plugin to ${project.root}/.mvn/extensions.xml

<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
    <extension>
        <groupId>com.google.cloud.artifactregistry</groupId>
        <artifactId>artifactregistry-maven-wagon</artifactId>
        <version>2.1.1</version>
    </extension>
</extensions>

See https://issues.apache.org/jira/browse/MNG-5771 for additional info. I'm closing the issue, feel free to re-open if the issue persists.

JohanLorenzo commented 3 years ago

Hey @Gridasov!

Thanks for your totally-on-point answer 👍 I just tried it and I confirm it works on the reduced case I mentioned above. I'll try this out on our bigger project and update this ticket. It'll probably take a few weeks. Let's keep this issue closed, then 🙂