Regarding the "annotation processors" on compile classpath warning in Gradle 4.6

(Stefan Oehme) #21

Have you looked which task is sending the warning? I suspect you have some leaking onto your test classpath.

(Jörn Huxhorn) #22

The actual message looks like this:

> Task :converter-log4j2:compileJava UP-TO-DATE
Detecting annotation processors on the compile classpath has been deprecated. Gradle 5.0 will ignore annotation processors on the compile classpath. The following annotation processors were detected on the compile classpath: 'org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor'.  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.

Just tried it with an additional

compileTestJava {
    options.compilerArgs += '-proc:none'
}

to be on the safe side (even though that specific modules doesn’t even have any tests, just src/main/java) but to no avail.

I also tried whether this is module is the module that actually causes the issue by only building another module (no warning) vs. only building the above module (warning).

Am I missing something? Is the way I set the compiler args wrong?

2 Likes
(Stefan Oehme) #23

Looks fine to me. We have an integration test doing the same thing and not showing a warning. A reproducible example would help.

(Vladimir Kroz) #24

@Jörn Huxhorn – Thanks a lot!

compileTestJava {
    options.compilerArgs += '-proc:none'
}

works like a charm with Gradle 4.10.
My root cause of the warning was caused by log4j2 declared as dependency. Apparently log4j2 contains annotation processors within its jars.

(Reinhard) #25

Maybe try compileJava instead of compileTestJava?:

compileJava {
    options.compilerArgs += '-proc:none'
}

That worked for me to get the log4j warning sorted.