Lombok compiler warnings only showing on first build

I am trying to figure out why build warnings only show up during the first build where the code is introduced. I am seeing it with compile warnings for Lombok but am not sure if it is exclusively Lombok. For example, I created a new class with the @Builder annotation that has a field with a value. This is the warning that I get when I run ./gradlew build:

warning: @Builder will ignore the initializing expression entirely. If you want the initializing expression to serve as default, add @Builder.Default. ...

That warning only shows up the first time I run build. Subsequent builds show no warnings. I have tried closing the Gradle Daemon, deleting the .gradle directory, deleting my build/output directories, and running in a new terminal. I even upgraded from Gradle 4.8.1 to 5.4.1. The only way I can get the warnings with subsequent builds is to change the Java code in the affected class or create new classes that generates the warnings.

Is this the expected behavior? How can I compile and see the warnings again?

That’s expected: it is a warning, not a failure. Gradle only runs tasks which did not complete in the last build, or whose inputs have changed.

Is there some task or flag I can use to rerun that task and show the warnings again?

Nevermind. I found the flag --rerun-tasks that works. Thanks for the info.

1 Like