I'm using a Bazel toolchain based on ecj
. When compiling my sources, I want to use the properties that are saved in a specific file. Therefor I try:
java_binary(
name = "foo",
javacopts = [
"-properties",
"$(location .settings/org.eclipse.jdt.core.prefs)",
],
srcs = [...},
)
However, Bazel complains:
$(location) expression is not a declared prerequisite of this rule
With Bazel <5, I added data = ".settings/org.eclipse.jdt.core.prefs"
. Problem solved.
However, with Bazel 5, the attribute data
now works according to specifications: data
files are provided only during runtime of the java_binary
, not during compile time. Therefor, ecj
complains during compilation:
properties file vobs/zenith/workspace/stex/templates/.settings/org.eclipse.jdt.core.prefs does not exist
Any idea on how to solve this problem?