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

Snapshot artifacts are not resolved by the Maven resolver #1147

Open
tharakadesilva opened this issue May 23, 2024 · 1 comment
Open

Snapshot artifacts are not resolved by the Maven resolver #1147

tharakadesilva opened this issue May 23, 2024 · 1 comment

Comments

@tharakadesilva
Copy link

In Artifactory, we have a repository called maven and inside maven, we can assume we have a library under maven/my/org/my-library/0.3.0-SNAPSHOT.

In this index, we have the following files:

  • maven-metadata.xml
  • my-library-0.3.0-20240502.142408-1-javadoc.jar
  • my-library-0.3.0-20240502.142408-1-sources.jar
  • my-library-0.3.0-20240502.142408-1.jar
  • my-library-0.3.0-20240502.142408-1.pom
  • my-library-0.3.0-20240503.081128-2.jar
  • my-library-0.3.0-20240503.081128-2.pom

However, when we try to refer to it with something like maven.artifact("my.org", "my-library", "0.3.0-SNAPSHOT"), we are getting:

java.lang.RuntimeException: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact my.org:my-library:pom:0.3.0-SNAPSHOT
        at com.github.bazelbuild.rules_jvm_external.resolver.maven.MavenResolver.resolve(MavenResolver.java:247)
        at com.github.bazelbuild.rules_jvm_external.resolver.cmd.Main.main(Main.java:74)
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact my.org:my-library:pom:0.3.0-SNAPSHOT
        at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:464)
        at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:261)
        at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:243)
        at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:234)
        at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:175)
        at org.eclipse.aether.internal.impl.collect.bf.BfDependencyCollector.resolveCachedArtifactDescriptor(BfDependencyCollector.java:464)
        at org.eclipse.aether.internal.impl.collect.bf.BfDependencyCollector.resolveDescriptorForVersion(BfDependencyCollector.java:450)
        at org.eclipse.aether.internal.impl.collect.bf.BfDependencyCollector.lambda$resolveArtifactDescriptorAsync$1(BfDependencyCollector.java:417)
        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
        at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
        at org.eclipse.aether.internal.impl.collect.bf.BfDependencyCollector.lambda$resolveArtifactDescriptorAsync$4(BfDependencyCollector.java:416)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)

This was resolved with Coursier and the lock file was generated.

Additional Information:

Bazel Version: 6.5.0
rules_jvm_eternal Version: 6.1
Operating System: MacOS

@cheister
Copy link
Collaborator

cheister commented Jul 1, 2024

Just noting, snapshot artifacts will never work for maven_installs that use a lockfile since the version (0.3.0-20240503.081128-2) and SHA of the snapshot jar can change without changing the artifact version (0.3.0-SNAPSHOT), which would make the lockfile incorrect.

Since the maven resolver requires a lock file we would have to add a feature for the maven resolver to not require the lockfile before looking at supporting snapshot repos.

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

2 participants