bazel: Bazel doesn't store java tests in remote cache

Description of the problem / feature request:

Bazel doesn’t store java tests in remote cache.

Feature requests: what underlying problem are you trying to solve with this feature?

I want to share test results across different machines.

Bugs: what’s the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

BUILD.bazel:

java_test(
    name = "java_test",
    size = "small",
    test_class = "AllTests",
    srcs = [
        "src/AllTests.java",
    ],
)

py_test(
    name = "python_test",
    srcs = [
        "src/python_test.py"
    ],
)

After running tests on the first machine, tests shound’t run on the second. Only python tests are cached:

$ bazel test --remote_http_cache=http://10.0.0.1:8080 --remote_upload_local_results=false //...
Starting local Bazel server and connecting to it...
........
INFO: Analysed 2 targets (20 packages loaded).
INFO: Found 2 test targets...
INFO: Elapsed time: 3.890s, Critical Path: 0.58s
INFO: 3 processes: 2 remote cache hit, 1 linux-sandbox.
INFO: Build completed successfully, 11 total actions
//:python_test                                                  (cached) PASSED in 0.1s
//:java_test                                                             PASSED in 0.3s

Executed 1 out of 2 tests: 2 tests pass.
INFO: Build completed successfully, 11 total actions

What operating system are you running Bazel on?

Ubuntu 18.04.1

What’s the output of bazel info release?

release 0.15.2

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

@alexandrvb please apologize the delay. The proper solution is to specify your own https://docs.bazel.build/versions/master/be/java.html#java_runtime and not use the system JDK. Essentially, you can specify a zip file containing a JDK and then have all your users use this.