Bazel displays all compilation warnings during the clean compilation (java).
But - when we rerun bazel build - we lose all the warnings.
Is there any flag that would make it display the original warnings for cached targets?
Example repo: https://github.com/or-shachar/bazel-sample-repo/tree/warning (branch warning)
First run output:
ā bazel build //...
INFO: Found 1 target...
INFO: From Building src/main/java/com/example/libmy_warning_lib.jar (1 source file):
src/main/java/com/example/MyLib.java:12: warning: [static] static variable should be qualified by type name, MyLib, instead of by an expression
this.x = this.x + 2.1;
^
src/main/java/com/example/MyLib.java:12: warning: [static] static variable should be qualified by type name, MyLib, instead of by an expression
this.x = this.x + 2.1;
^
Target //src/main/java/com/example:my_warning_lib up-to-date:
bazel-bin/src/main/java/com/example/libmy_warning_lib.jar
INFO: Elapsed time: 3.286s, Critical Path: 1.03s
Next run:
ā bazel build //...
INFO: Found 1 target...
Target //src/main/java/com/example:my_warning_lib up-to-date:
bazel-bin/src/main/java/com/example/libmy_warning_lib.jar
INFO: Elapsed time: 0.244s, Critical Path: 0.01s
As you can see - we're losing the warnings on cached run. If it's not available by some flag - it might worth to be added as a feature.