Skip to content

Ensure that the pom classifier isn't always downloaded #1251

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

Merged
merged 5 commits into from
Sep 18, 2024

Conversation

shs96c
Copy link
Collaborator

@shs96c shs96c commented Sep 17, 2024

Closes #1250

This reverts commit 213ac8f.

Turns out that we can't use skylib here.
@shs96c shs96c merged commit 8388bef into bazel-contrib:master Sep 18, 2024
8 checks passed
@shs96c shs96c deleted the poms-and-jars branch September 18, 2024 13:04
airlock-confluentinc bot pushed a commit to confluentinc/rules_jvm_external that referenced this pull request Sep 19, 2024
@honnix
Copy link
Contributor

honnix commented Oct 11, 2024

Not exactly sure how it happens, but I think this change results in duplicated symlink creation, which obviously fails. It seems duplicated entries appear in amended_deps.

@honnix
Copy link
Contributor

honnix commented Oct 11, 2024

I tried this patch and it worked:

diff --git a/private/rules/coursier.bzl b/private/rules/coursier.bzl
index 530a90b..28e3746 100644
--- a/private/rules/coursier.bzl
+++ b/private/rules/coursier.bzl
@@ -954,6 +954,8 @@ def rewrite_files_attribute_if_necessary(repository_ctx, dep_tree):
         # `pinned_maven_install`. Oh well, let's just do this the manual way.
         if dep["file"].endswith(".pom"):
             jar_path = dep["file"].removesuffix(".pom") + ".jar"
+            if is_dep(jar_path, amended_deps):
+                continue
             if repository_ctx.path(jar_path).exists:
                 dep["file"] = jar_path
 
@@ -963,6 +965,12 @@ def rewrite_files_attribute_if_necessary(repository_ctx, dep_tree):
 
     return dep_tree
 
+def is_dep(jar_path, deps):
+    for dep in reversed(deps):
+        if jar_path == dep.get("file", None):
+            return True
+    return False
+
 def remove_prefix(s, prefix):
     if s.startswith(prefix):
         return s[len(prefix):]

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

Successfully merging this pull request may close these issues.

Attempting to resolve com.github.spotbugs:spotbugs:4.7.0 with the coursier resolver does not result in binaries being available
3 participants