I have received the following message when working with a gradle 4.7 project
The following annotation processors were detected on the compile classpath: 'lombok.launch.AnnotationProcessorHider$AnnotationProcessor' and 'lombok.launch.AnnotationProcessorHider$ClaimingProcessor'. Detecting annotation processors on the compile classpath is
Deprecated and Gradle 5.0 will ignore them. Please add them to the annotation processor path instead. If you did not intend to use annotation processors, you can use the '-proc:none' compiler argument to ignore them.
when running
gradlew build --warning-mode=all
on a project with the following Gradle configuration
compileOnly('org.projectlombok:lombok')
testCompileOnly('org.projectlombok:lombok')
As the warning suggests, it is recommended to place these on the annotationProcessor
(and testAnnotationProcessor
) configurations in order to be compatible with gradle 5.0
annotationProcessor('org.projectlombok:lombok')
testAnnotationProcessor('org.projectlombok:lombok')
However, with a simple test:
@Slf4j
public class LombokTests {
@Test
public void lombokCompiles() {
log.info("foobar");
}
}
That configuration fails:
> Task :compileTestJava FAILED
D:\Users\bobjones\repos\my-new-app\src\test\java\com\example\app\LombokTests.java:10: error: cannot find symbol
@Slf4j
^
symbol: class Slf4j
1 error
Am I missing something?
compileOnly
/testCompileOnly
configurationannotationProcessor('org.projectlombok:lombok')
compileOnly('org.projectlombok:lombok')
testAnnotationProcessor('org.projectlombok:lombok')
testCompileOnly('org.projectlombok:lombok')
According to the documentation, the annotationProcessor config still requires the compileOnly
(and testCompileOnly
for test classes) configuration to function. As for support for incremental annotation processing, the implementers of Lombok have just merged in support to master but as of 25th May 2018 have not included a go-live version.
Their last version 16.2.20 spanning commits up until the 9th of Jan 2018 and the Gradle change was pulled into master on the 15th of May 2018 So I suspect the new version won't be far from release, although their 'Edgy' release does not include any notes regarding this feature.
A Gradle plugin is available by io.freefair that configures these settings and more automatically and helps keep lombok up-to-date (of course you may override the lombok version yourself).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With