rules_jvm_external icon indicating copy to clipboard operation
rules_jvm_external copied to clipboard

Looks like maven:compile-only dependencies included in the java_export produced jar

Open gkdn opened this issue 1 year ago • 0 comments

It looks like java_export includes classes from targets marked with maven:compile_only.

I have seen this in google_bazel_common examples. For example: AutoValue is such tagged target but I needed to exclude that from Closure Compiler in this PR.

Linked PR includes relevant test and should be reproducable by removing excluded_workspaces from java_export.

I am also working on a patch that upgrades Closure Compiler to Bazel 8 and uses latest versions of rules_jvm_external and google_bazel_common and I can confirm that problem still exists and unfortunately existing workaround doesn't work anymore since google_bazel_common generated targets show rules_jvm_external as workspace now:

DEBUG: /private/var/tmp/_bazel_goktug/XXXX/external/rules_jvm_external+/private/rules/maven_project_jar.bzl:27:14: rules_jvm_external <generated file external/rules_jvm_external++maven+google_bazel_common_maven/javax/annotation/jsr250-api/1.0/processed_jsr250-api-1.0.jar>
DEBUG: /private/var/tmp/_bazel_goktug/XXXX/external/rules_jvm_external+/private/rules/maven_project_jar.bzl:27:14: rules_jvm_external <generated file external/rules_jvm_external++maven+google_bazel_common_maven/com/google/auto/value/auto-value-annotations/1.11.0/processed_auto-value-annotations-1.11.0.jar>

I'm switching to a different workaround to use deploy_env attribute but I thought the issue is worthwhile reporting.

gkdn avatar Dec 21 '24 03:12 gkdn