please icon indicating copy to clipboard operation
please copied to clipboard

java_library fails with "Empty source path" on please 17.1.0

Open hnridder opened this issue 2 years ago • 1 comments

(Maybe this belongs to the please-build/java-rules repo, but since this is a regression I'm reporting it here.)

I recently upgraded from 16.27.5 to 17.1.0, applied the java plugin and now java_library fails with an "Empty source path" error. Simple reproduction scenario: . plz init . plz init plugin java . Add the path to the local java binaries to build.path in .plzconfig . Create a small java file Main.java . Create a BUILD file:

java_library(
   name = 'core',
   srcs = ['Main.java'],
)

. plz build gives the output:

Build stopped after 180ms. 1 target failed:
    //:all
plz-out/gen/java/build_defs/java.build_defs:80:16: error: Empty source path

        return build_rule(
(... and more...)

Turning on debugging output reveals the origin to be targets.go:261, which is addMaybeNamedOrString(s, "tools",... So apparently the compiler isn't found by java.build_defs. I tried (among other things) setting [Plugin "java"].JavacTool to the fullpath of the java compiler, but that didn't help. Neither did fumbling around with the Toolchain setting.

Expected result:

  • Local java installation is picked up.
  • Documentation of the Java options (JavacTool, Toolchain) clarify how to use them.

hnridder avatar Jul 11 '23 13:07 hnridder

This issue has been automatically marked as stale because it has not had any recent activity in the past 90 days. It will be closed if no further activity occurs. If you require additional support, please reply to this message. Thank you for your contributions.

stale[bot] avatar Apr 26 '25 01:04 stale[bot]