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

Could not find artifact org.apache.maven.surefire:surefire-providers:pom:2.22.2 #281

Closed
ppalaga opened this issue Dec 21, 2020 · 4 comments
Milestone

Comments

@ppalaga
Copy link
Contributor

ppalaga commented Dec 21, 2020

Happens intermittently on the CI.

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project multi-module-hello: Unable to generate classpath: org.apache.maven.artifact.resolver.ArtifactResolutionException: Unable to get dependency information for org.apache.maven.surefire:surefire-junit-platform:jar:2.22.2: Failed to process POM for org.apache.maven.surefire:surefire-junit-platform:jar:2.22.2: Non-resolvable parent POM for org.apache.maven.surefire:surefire-junit-platform:2.22.2: Could not find artifact org.apache.maven.surefire:surefire-providers:pom:2.22.2
[ERROR]   org.apache.maven.surefire:surefire-junit-platform:jar:2.22.2
[ERROR] 
[ERROR] from the specified remote repositories:
[ERROR]   central (https://repo.maven.apache.org/maven2, releases=true, snapshots=false)

	at org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector.recurse(DefaultLegacyArtifactCollector.java:596)
	at org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector.collect(DefaultLegacyArtifactCollector.java:148)
	at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:504)
	at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveWithExceptions(DefaultArtifactResolver.java:358)
	at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:352)
	at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:324)
	at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:287)
	at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:261)
	at org.apache.maven.plugin.surefire.SurefireDependencyResolver.resolveArtifact(SurefireDependencyResolver.java:130)
	at org.apache.maven.plugin.surefire.SurefireDependencyResolver.getProviderClasspath(SurefireDependencyResolver.java:143)
	at org.apache.maven.plugin.surefire.AbstractSurefireMojo$JUnitPlatformProviderInfo.getProviderClasspath(AbstractSurefireMojo.java:2929)
	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.createStartupConfiguration(AbstractSurefireMojo.java:1721)
	... 16 common frames omitted
Caused by: org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException: Failed to process POM for org.apache.maven.surefire:surefire-junit-platform:jar:2.22.2: Non-resolvable parent POM for org.apache.maven.surefire:surefire-junit-platform:2.22.2: Could not find artifact org.apache.maven.surefire:surefire-providers:pom:2.22.2
	at org.apache.maven.project.artifact.MavenMetadataSource.retrieveRelocatedProject(MavenMetadataSource.java:600)
	at org.apache.maven.project.artifact.MavenMetadataSource.retrieve(MavenMetadataSource.java:211)
	at org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector.recurse(DefaultLegacyArtifactCollector.java:551)
	... 27 common frames omitted
Caused by: org.apache.maven.model.resolution.UnresolvableModelException: Could not find artifact org.apache.maven.surefire:surefire-providers:pom:2.22.2
	at org.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:196)
	at org.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:242)
	at org.apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultModelBuilder.java:1070)
	at org.apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.java:846)
	at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:337)
	at org.apache.maven.project.CachingProjectBuilder.build(CachingProjectBuilder.java:169)
	at org.apache.maven.project.CachingProjectBuilder.build(CachingProjectBuilder.java:313)
	at org.apache.maven.project.CachingProjectBuilder.build(CachingProjectBuilder.java:276)
	at org.apache.maven.project.artifact.MavenMetadataSource.retrieveRelocatedProject(MavenMetadataSource.java:591)
	... 29 common frames omitted
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact org.apache.maven.surefire:surefire-providers:pom:2.22.2
	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.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:262)
	at org.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:192)
	... 37 common frames omitted
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact org.apache.maven.surefire:surefire-providers:pom:2.22.2
	at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:414)
	... 41 common frames omitted
ppalaga added a commit to ppalaga/mvnd that referenced this issue Dec 21, 2020
ppalaga added a commit that referenced this issue Dec 21, 2020
@ppalaga
Copy link
Contributor Author

ppalaga commented Dec 25, 2020

Same with org.junit.platform:junit-platform-launcher:jar:1.3.1 https://github.com/mvndaemon/mvnd/pull/286/checks?check_run_id=1606850304

ppalaga added a commit to ppalaga/mvnd that referenced this issue Jan 4, 2021
ppalaga added a commit that referenced this issue Jan 4, 2021
ppalaga added a commit to ppalaga/mvnd that referenced this issue Jan 7, 2021
ppalaga added a commit to ppalaga/mvnd that referenced this issue Jan 7, 2021
ppalaga added a commit to ppalaga/mvnd that referenced this issue Jan 8, 2021
ppalaga added a commit to ppalaga/mvnd that referenced this issue Jan 8, 2021
ppalaga added a commit to ppalaga/mvnd that referenced this issue Jan 8, 2021
ppalaga added a commit that referenced this issue Jan 8, 2021
@lanmaoxinqing
Copy link
Contributor

Hi @ppalaga , I also met this question. In my situation it happens when muti modules rely on the same dependency and download concurrently.

The dependency does not exist in the primary repository but exists in the secondary repository.

Dependency download events logged with following sequence:

10:43:11.900 I Dispatch message: TransferInitiated{projectId=${ModuleA}, requestType=0, repositoryId='${PrimaryRepository}', repositoryUrl='${PrimaryRepository}', resourceName='${CommonDependency}.jar', contentLength=-1, transferredBytes=0, exception='null'}
10:43:12.030 I Dispatch message: TransferInitiated{projectId=${ModuleB}, requestType=0, repositoryId='${PrimaryRepository}', repositoryUrl='${PrimaryRepository}', resourceName='${CommonDependency}.jar', contentLength=-1, transferredBytes=0, exception='null'}
10:43:12.037 I Dispatch message: TransferFailed{projectId=${ModuleB}, requestType=0, repositoryId='${PrimaryRepository}', repositoryUrl='${PrimaryRepository}', resourceName='${CommonDependency}.jar', contentLength=-1, transferredBytes=0, exception='org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact ${CommonDependency}.jar in mirror-all (${PrimaryRepository})'}
10:43:14.918 I Dispatch message: TransferFailed{projectId=${ModuleA}, requestType=0, repositoryId='${PrimaryRepository}', repositoryUrl='${PrimaryRepository}', resourceName='${CommonDependency}.jar', contentLength=-1, transferredBytes=0, exception='org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact ${CommonDependency}.jar in mirror-all (${PrimaryRepository})'}
10:43:14.924 I Dispatch message: TransferInitiated{projectId=${ModuleA}, requestType=0, repositoryId='${SecondaryRepository}', repositoryUrl='${SecondaryRepository}', resourceName='${CommonDependency}.jar', contentLength=-1, transferredBytes=0, exception='null'}
10:43:14.951 I Dispatch message: TransferStarted{projectId=${ModuleA}, requestType=0, repositoryId='${SecondaryRepository}', repositoryUrl='${SecondaryRepository}', resourceName='${CommonDependency}.jar', contentLength=128469, transferredBytes=0, exception='null'}
10:43:15.125 I Dispatch message: TransferSucceeded{projectId=${ModuleA}, requestType=0, repositoryId='${SecondaryRepository}', repositoryUrl='${SecondaryRepository}', resourceName='${CommonDependency}.jar', contentLength=128469, transferredBytes=128469, exception='null'}
10:43:17.750 I Dispatch message: TransferInitiated{projectId=${ModuleC}, requestType=0, repositoryId='${PrimaryRepository}', repositoryUrl='${PrimaryRepository}', resourceName='${CommonDependency}.jar', contentLength=-1, transferredBytes=0, exception='null'}
10:43:17.763 I Dispatch message: TransferFailed{projectId=${ModuleC}, requestType=0, repositoryId='${PrimaryRepository}', repositoryUrl='${PrimaryRepository}', resourceName='${CommonDependency}.jar', contentLength=-1, transferredBytes=0, exception='org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact ${CommonDependency}.jar in mirror-all (${PrimaryRepository})'}

A TransferFailed event occured when trying to download from the primary repository, caught by ArtifactTransportListener and throws as ArtifactNotFound exception.
It seems that ModuleA redownload from Secondary repository and reover the exception, but moduleB and module C did not retry and hold the exception , I still can not figure out why it happened.
Hope this may help you.

@lanmaoxinqing
Copy link
Contributor

Hi @ppalaga @gnodet ,

concurrent access supported by takari mentioned in #14 is no longer effects in maven 3.x as commentted from ArkelGael SELIG & Michael Osipov in MNG-2802
Upgrade maven-resolver version may be the solution:

  • 1.5 (using global lock for single JVM) MRESOLVER-123
  • or 1.6 (using RedissonSyncContextFactory for multi-JVM, natural supported on maven 3.8.0) , MRESOLVER-131

This issue is gone in my local env after the upgrade, I'll submit a PR to see whether it's useful in github ci.

@gnodet
Copy link
Contributor

gnodet commented May 19, 2021

This is supposed to be working now, with the upgrade to maven 3.8.0 and the new rpc sync context.

@gnodet gnodet closed this as completed May 19, 2021
@ppalaga ppalaga added this to the 0.6.0 milestone Oct 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants