cc @comius @c-mita  It's seems the issue is that cc_tests unconditionally pulls those coverage tools dependencies.
https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/analysis/test/TestConfiguration.java;l=255-270
`cc_test` rules trigger remote JDK download (~200 MB)
### Description of the problem / feature request:

`cc_test` rules trigger remote JDK download (~200 MB), which is undesirable when operating under constraints on storage capacity and/or network capacity. https://en.wikipedia.org/wiki/Principle_of_least_astonishment also applies.

### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

```
$ rm -rf $HOME/.cache/bazel
$ git clone https://github.com/google/re2.git
$ cd re2
$ bazel build //:all --experimental_repository_resolved_file=resolved.bzl
$ grep openjdk resolved.bzl
$ bazel query 'somepath(//:all, @remote_coverage_tools//:all)'
```

### What operating system are you running Bazel on?

Linux

### What's the output of `bazel info release`?

```
release 5.0.0
```

src/main/java/com/google/devtools/build/lib/analysis/BUILD src/main/java/com/google/devtools/build/lib/rules/BUILD
src/main/java/com/google/devtools/build/lib/analysis/BUILD src/main/java/com/google/devtools/build/lib/rules/BUILD
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/BUILD b/src/main/java/com/google/devtools/build/lib/analysis/BUILD
index 350541aee2ad63..8076305da098c7 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/BUILD
+++ b/src/main/java/com/google/devtools/build/lib/analysis/BUILD
@@ -2541,7 +2541,7 @@ java_library(
         "//src/main/java/com/google/devtools/build/lib/concurrent",
         "//src/main/java/com/google/devtools/build/lib/starlarkbuildapi/test",
         "//src/main/java/com/google/devtools/common/options",
-        "//third_party:jsr305",
+        "//third_party:jsr305_checked_in",
     ],
 )
 
diff --git a/src/main/java/com/google/devtools/build/lib/rules/BUILD b/src/main/java/com/google/devtools/build/lib/rules/BUILD
index 2a256ca6b2e02a..0b555ff8067976 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/BUILD
+++ b/src/main/java/com/google/devtools/build/lib/rules/BUILD
@@ -59,6 +59,7 @@ java_library(
         "//src/main/java/com/google/devtools/build/lib/actions",
         "//src/main/java/com/google/devtools/build/lib/actions:artifacts",
         "//src/main/java/com/google/devtools/build/lib/analysis:analysis_cluster",
+        "//src/main/java/com/google/devtools/build/lib/analysis:configured_target",
         "//src/main/java/com/google/devtools/build/lib/analysis:test/coverage_configuration",
         "//src/main/java/com/google/devtools/build/lib/analysis:test/test_configuration",
         "//src/main/java/com/google/devtools/build/lib/analysis:test/test_trimming_transition_factory",
