-
-
Notifications
You must be signed in to change notification settings - Fork 258
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
Documentation for resolving Found duplicate artifact versions
#708
Comments
+1 I am currently not sure how to go about resolving duplicate artifacts. |
Duplicate artefacts are listed when the same artefact is in the list given to |
Does it work with having multiple android version installed? How can I resolve it?
|
A typical case of this is:
if you have (something) like: maven_install(
artifacts = IO_GRPC_GRPC_JAVA_ARTIFACTS + [
"junit:junit:4.13.2",
"com.google.guava:guava:33.0.0-jre", Because Here is one way to fix this, as I have done here: # This is required so that we can use duplicate_version_warning (below) and fixes
# the "com.google.guava:guava has multiple versions 32.1.3-android, 33.0.0-jre" problem.
IO_GRPC_GRPC_JAVA_ARTIFACTS_WITHOUT_GUAVA = [item for item in IO_GRPC_GRPC_JAVA_ARTIFACTS if item != "com.google.guava:guava:32.1.3-android"]
maven_install(
artifacts = IO_GRPC_GRPC_JAVA_ARTIFACTS_WITHOUT_GUAVA + [
"junit:junit:4.13.2",
"com.google.guava:guava:33.0.0-jre",
],
duplicate_version_warning = "error",
) |
The duplicate warning occurs when using bzlmod on an empty maven list. The trick is to add an explicit maven.artificact for guava. bazel_dep(name = "protobuf", version = "21.7", repo_name = "com_google_protobuf")
bazel_dep(name = "rules_java", version = "7.5.0")
bazel_dep(name = "rules_jvm_external", version = "6.1")
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven.artifact(
artifact = "guava",
exclusions = ["com.google.code.findbugs:jsr305"],
group = "com.google.guava",
version = "31.1-jre",
)
maven.install(
name = "maven",
lock_file = "//:maven_install.json",
artifacts = [],
) |
Hey folks, I'm also getting these and I'd like to clean them up... However, from what I can tell my dependencies are transitive (I depend on grpc-kotlin and that depends on grpc-java). Any ideas on how I can tell it which version to use? |
I've proposed a docs update in #1303 to at least make this a bit clearer and avoid some future confusion for others. |
Would be great to document best-practices for resolving duplicate artifact versions
https://github.com/bazelbuild/rules_jvm_external/blob/master/coursier.bzl#L649
The text was updated successfully, but these errors were encountered: