Coverge support breaks when test has its own dependency on `org.jacoco.*`
As a coverage tool, it is highly unlikely that a library will include a genuine dependency on org.jacoco.*. However;
- There are no safeguards in place. If this does happen,
bazel coveragemay just not work. Ideally what I suspect to be a technical limitation would be reported on at compile time. - Sometimes third party packages include test dependencies as compile dependencies by mistake. e.g. https://github.com/aliyun/aliyun-openapi-java-sdk/pull/930
We actually ran into this with Jazzer, which has a legitimate need to depend on JaCoCo during regular execution. Shading helped here: https://github.com/CodeIntelligenceTesting/jazzer/blob/main/third_party/jacoco_internal.BUILD
Bazel has a built-in capability to detect classpath duplication, which I recently wired up to some extent. You could take a look at the test in https://github.com/bazelbuild/bazel/commit/417c6b803db1078d20077068471427c86c016190#diff-61be5294c014a8b30530f4e0801697cf6d8c1181d8e4400164b62ef00c2be0d5 and see whether this setup catches the issue.