How to fix error cannot find symbol builder lombok

The builder pattern is one of the finest design patterns that help to create a new instance of a class with the required details.

This can be easily done by annotating the class with the @Builder, but sometime we get the following error during the compilation.

error: cannot find symbol
symbol:   method builder()
location: class SearchQuery

To fix this add annotationProcessor to the build.gradle dependencies.

compileOnly 'org.projectlombok:lombok:1.18.24'
annotationProcessor 'org.projectlombok:lombok:1.18.24' // this will fix the error

Make sure the versions for both are the same.