bazel: genhtml can't find Java source files when generating a coverage report

Please provide the following information. The more we know about your system and use case, the more easily and likely we can help.

Description of the problem / feature request / question:

$ git clone --recursive https://gerrit.googlesource.com/gerrit

$ cd gerrit

$ bazel version Build label: 0.4.4 Build target: bazel-out/local-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar Build time: Wed Feb 1 18:54:21 2017 (1485975261) Build timestamp: 1485975261 Build timestamp as int: 1485975261

$ bazel coverage --test_output=streamed //gerrit-common:auto_value_tests … WARNING: Streamed test output requested so all tests will be run locally, without sharding, one at a time. INFO: Using default value for --instrumentation_filter: “//gerrit-common”. INFO: Override the above default with --instrumentation_filter INFO: Found 1 test target… JUnit4 Test Runner . Time: 0.027

OK (1 test)

BazelTestRunner exiting with a return value of 0 JVM shutdown hooks (if any) will run now. The JVM will exit once they complete.

– JVM shutdown starting at 2017-02-13 15:38:40 –

Exception in thread “main” java.lang.UnsupportedClassVersionError: com/google/devtools/lcovmerger/Main : Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:803) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:442) at java.net.URLClassLoader.access$100(URLClassLoader.java:64) at java.net.URLClassLoader$1.run(URLClassLoader.java:354) at java.net.URLClassLoader$1.run(URLClassLoader.java:348) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:347) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482) FAIL: //gerrit-common:auto_value_tests (see /home/hanwen/.cache/bazel/_bazel_hanwen/9590700e58e6cc9bff046cc6a346bc64/execroot/gerrit/bazel-out/local-fastbuild/testlogs/gerrit-common/auto_value_tests/test.log). Target //gerrit-common:auto_value_tests up-to-date: bazel-bin/gerrit-common/auto_value_tests.jar bazel-bin/gerrit-common/auto_value_tests

If asking a question or requesting a feature, also tell us about the underlying problem you’re trying to solve.

If possible, provide a minimal example to reproduce the problem:

Environment info

  • Operating System:

  • Bazel version (output of bazel info release):

  • If bazel info release returns “development version” or “(@non-git)”, please tell us what source tree you compiled Bazel from; git commit hash is appreciated (git rev-parse HEAD):

Have you found anything relevant by searching the web? (e.g. GitHub issues, email threads in the bazel-discuss@googlegroups.com archive)

Anything else, information or logs or outputs that would be helpful?

(If they are large, please upload as attachment or provide link).

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 29 (29 by maintainers)

Most upvoted comments

For me:

bazel coverage //projects/... \                             
--combined_report=lcov \
--coverage_report_generator=@bazel_tools//tools/test/LcovMerger/java/com/google/devtools/lcovmerger:Main \
--experimental_java_coverage

followed by

genhtml -o coverage bazel-out/_coverage/_coverage_report.dat

followed by

open coverage/index.html

Seems to have worked great (@sha 041f4deb315362180cb9ab2d112e5d44906299a0). Thanks!

screen shot 2018-08-21 at 8 43 24 am

see https://gerrit-review.googlesource.com/c/106471/ . From my perspective we can close this now