Closed borkaehw closed 5 years ago
I cannot reproduce this with rules_jvm_external on head.
maven_install(
name = "bingads",
artifacts = [
"com.microsoft.bingads:microsoft.bingads:12.13.3",
],
repositories = [
"https://repo.maven.apache.org/maven2",
],
fetch_sources = True,
# maven_install_json = "//:maven_install.json",
)
$ bazel query --output=build @bingads//:org_glassfish_ha_ha_api
# /usr/local/google/home/jingwen/.cache/bazel/_bazel_jingwen/8484bc4fff18ee4a905b69a9ddb0e143/external/bingads/BUILD:1372:1
jvm_import(
name = "org_glassfish_ha_ha_api",
tags = ["maven_coordinates=org.glassfish.ha:ha-api:3.1.12"],
jars = ["@bingads//:v1/https/repo.maven.apache.org/maven2/org/glassfish/ha/ha-api/3.1.12/ha-api-3.1.12.jar"],
srcjar = "@bingads//:v1/https/repo.maven.apache.org/maven2/org/glassfish/ha/ha-api/3.1.12/ha-api-3.1.12-sources.jar",
deps = [],
)
Same if I use maven_install.json:
maven_install(
name = "bingads",
artifacts = [
"com.microsoft.bingads:microsoft.bingads:12.13.3",
],
repositories = [
"https://repo.maven.apache.org/maven2",
],
fetch_sources = true,
maven_install_json = "//:bingads_install.json",
)
load("@bingads//:defs.bzl", "pinned_maven_install")
pinned_maven_install()
$ bazel query --output=build @bingads//:org_glassfish_ha_ha_api
# /usr/local/google/home/jingwen/.cache/bazel/_bazel_jingwen/8484bc4fff18ee4a905b69a9ddb0e143/external/bingads/BUILD:2242:1
jvm_import(
name = "org_glassfish_ha_ha_api",
tags = ["maven_coordinates=org.glassfish.ha:ha-api:3.1.12"],
jars = ["@bingads//:v1/https/repo.maven.apache.org/maven2/org/glassfish/ha/ha-api/3.1.12/ha-api-3.1.12.jar"],
srcjar = "@bingads//:v1/https/repo.maven.apache.org/maven2/org/glassfish/ha/ha-api/3.1.12/ha-api-3.1.12-sources.jar",
deps = [],
)
@jin Thanks for testing it out. I can confirm that it's not a problem on HEAD, but it's a problem on latest release 2.7
. Would you mind to test it again using 2.7
? If you can reproduce it and confirm the issue on 2.7
, we can simply make a release on HEAD and close this issue, even though I didn't dive in how the recent commits could have fixed this issue.
Hold on. By using HEAD, I see other deps are missing.
in deps attribute of jvm_import rule @maven//:com_microsoft_bingads_microsoft_bingads: rule '@maven//:com_sun_xml_ws_release_documentation_zip_docbook' does not exist
in deps attribute of jvm_import rule @maven//:com_microsoft_bingads_microsoft_bingads: rule '@maven//:com_sun_xml_ws_samples_zip' does not exist
in deps attribute of jvm_import rule @maven//:com_microsoft_bingads_microsoft_bingads: rule '@maven//:com_sun_xml_ws_jaxws_ri' does not exist
Dug a bit deeper:
com.sun.xml.ws:release-documentation
and com.sun.xml.ws:samples
are zip packaging types, but Coursier doesn't download them because it doesn't recognize zip
as a packaging type. The simplest workaround to is to exclude them in excluded_artifacts
.
com.sun.xml.ws:jaxws-ri
is a parent pom artifact, but for some reason when Coursier resolves it as a transitive artifact, it stops at that artifact. If you add it as a top level artifact, everything works.
Can you try this configuration at HEAD?
maven_install(
name = "bingads",
artifacts = [
"com.microsoft.bingads:microsoft.bingads:12.13.3",
"com.sun.xml.ws:jaxws-ri:2.3.2",
],
repositories = [
"https://repo.maven.apache.org/maven2",
],
fetch_sources = True,
excluded_artifacts = [
"com.sun.xml.ws:samples",
"com.sun.xml.ws:release-documentation",
],
)
The principled fix here is to iterate through all dependencies of every target, and filter away the ones that don't have a top level Bazel target / mapped jar or aar artifact.
Can you try this configuration at HEAD?
Yes, this config works. Thanks.
filter away the ones that don't have a top level Bazel target / mapped jar or aar artifact.
I am fine with the workaround as long as it doesn't cause other issues. Looking forward to principled fix. It would be nice to have a release on HEAD.
Done: https://github.com/bazelbuild/rules_jvm_external/releases/tag/2.8
I'll close this for now, since the workaround is OK. I'll revisit this if there are more instances of breakages like this.
I am seeing a similar issue described in https://github.com/bazelbuild/rules_jvm_external/issues/201, I also left a comment https://github.com/bazelbuild/rules_jvm_external/issues/201#issuecomment-518412423 back then. It seems like https://github.com/bazelbuild/rules_jvm_external/pull/215 didn't fix all the similar issues.
I see an error of
when trying to build a target that depends on
@maven//:com_microsoft_bingads_microsoft_bingads
. I can see@maven//:org_glassfish_ha_ha_api
is never being generated. The following are myWORKSPACE
andmaven_install
.WORKSPACE
:maven_install
:I am happy to provide minimal reproducible case if that makes investigation easier. Thanks.