rules_jvm_external icon indicating copy to clipboard operation
rules_jvm_external copied to clipboard

java_export throwing error with java8

Open prashantsharma04 opened this issue 3 years ago • 5 comments

ATTENTION! Please read and follow:

Description of the problem / feature request:

The command "bazel run --define "maven_repo=file://$HOME/.m2/repository" //multiplication:mul.publish" for my project bazel-playground in addition module is working perfectly with java11 but with java8 it is throwing the error

"javadoc: error - Cannot find doclet class com.sun.tools.doclets.standard.Standard"

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

How can I make it work for java8

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

The command which produced this error is

bazel run --define "maven_repo=file://$HOME/.m2/repository" //multiplication:mul.publish

What operating system are you running Bazel on?

MacOS

What's the output of bazel info release?

javadoc -cp bazel-out/darwin-fastbuild/bin/multiplication/mul-project.jar -html5 --frames -notimestamp -use -quiet -Xdoclint:-missing -encoding UTF8 -d /var/folders/xm/ll935y3n3z3c9b49jqkxgllh0000gn/T/output-dir5825888492608995641 /var/folders/xm/ll935y3n3z3c9b49jqkxgllh0000gn/T/unpacked-sources2427846225390080065/mul/MainApplication.java /var/folders/xm/ll935y3n3z3c9b49jqkxgllh0000gn/T/unpacked-sources2427846225390080065/add/Addition.java /var/folders/xm/ll935y3n3z3c9b49jqkxgllh0000gn/T/unpacked-sources2427846225390080065/mul/Multiplication.java javadoc: error - Cannot find doclet class com.sun.tools.doclets.standard.Standard 1 error

Links to my code

Here is my code link : https://github.com/wings-software/bazel-playground/tree/brijesh/bazel We posted it on slack few days ago and the conversation has some findings. Might be useful. https://bazelbuild.slack.com/archives/CDCE4DFAP/p1595443365163000

prashantsharma04 avatar Jul 30 '20 08:07 prashantsharma04

cc @shs96c

jin avatar Jul 30 '20 08:07 jin

The link to the repro 404's for me, but I've seen this before when someone was using a vanilla javatool chain rather than one of the regular ones. Can you please share your host_javabase, javabase, host_java_toolchain, and java_toolchain if they've been changed?

shs96c avatar Oct 01 '20 10:10 shs96c

you can also try with

bazel run --java_toolchain=@bazel_tools//tools/jdk:toolchain_java8 --define "maven_repo=file://$HOME/.m2/repository" //multiplication:mul.publish

dmivankov avatar Dec 01 '20 14:12 dmivankov

@shs96c @dmivankov This error still happens to me, my local_jdk is jdk8 too. This is my bazelrc configuration about java toolchain:

build --javabase=@local_jdk//:jdk
build --host_javabase=@local_jdk//:jdk
build --java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla
build --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla

But it may not be the problem of vanilla javatool chain, because when i change javabase&host_javabase to remote_jdk11, it works perfectly, just like:

build --javabase=@bazel_tools//tools/jdk:remote_jdk11
build --host_javabase=@bazel_tools//tools/jdk:remote_jdk11
build --java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla
build --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla

chenchenji avatar Jun 11 '22 19:06 chenchenji

I'm happy to take a PR to help fix this, but since Java 8 has been EoL'd (and only has extended support from Oracle now), Bazel itself has switched to Java 11, Java 17 is the current LTS release, and I've not got a huge amount of time to dig into the issue, this is a low priority for me.

If you'd like to chat about getting familiar with the code and figuring out what needs to be done, I'm nearly always in the Bazel Slack channels during UK working hours, and I'm happy to help there.

shs96c avatar Jun 13 '22 08:06 shs96c