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

Depending on both POM and JAR of the same maven artifact causes symlink error at artifacts pinning #1267

Open
cerisier opened this issue Oct 12, 2024 · 0 comments

Comments

@cerisier
Copy link

cerisier commented Oct 12, 2024

Description

After updating to 6.4, when trying to pin artifacts, bazel reported the following error:

ERROR: An error occurred during the fetch of repository 'rules_jvm_external~~maven~unpinned_maven':
   Traceback (most recent call last):
	File "external/rules_jvm_external~/private/rules/coursier.bzl", line 1077, column 84, in _coursier_fetch_impl
		artifact.update({"file": _relativize_and_symlink_file_in_coursier_cache(repository_ctx, artifact["file"], coursier_cache_path)})
	File "external/rules_jvm_external~/private/rules/coursier.bzl", line 231, column 31, in _relativize_and_symlink_file_in_coursier_cache
		repository_ctx.symlink(absolute_path, repository_ctx.path(artifact_relative_path))
Error in symlink: java.io.IOException: Could not create symlink <skipped> (File exists)

After investigation, I found that 2 of my dependencies were transitively depending on the same maven artifact, one with explicit jar packaging and one without (default to pom), specifically:

  • org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3
  • org.jetbrains.kotlinx:kotlinx-coroutines-core:jar:1.7.3 (note the :jar)

And the introduction of 8388bef, such case will cause a duplicate entry in the dep_tree since both entries for the pom and the jar coordinates of the same artifact will both have their file point the the same .jar.

if dep["file"].endswith(".pom"):
jar_path = dep["file"].removesuffix(".pom") + ".jar"
if repository_ctx.path(jar_path).exists:
dep["file"] = jar_path

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 a pull request may close this issue.

1 participant