Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configure gradle with annotationProcessor and log4j2 PluginProcessor

I was trying to build my project with gradle. I got this error:

"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."

I got that I have to use annotattionProcessor instead of compile. But how actually to do it. Here is the part of my gradle file dependencies:

dependencies {
    implementation 'org.apache.logging.log4j:log4j-api:2.11.1'
    implementation 'org.apache.logging.log4j:log4j-core:2.11.1'
}

I was trying to use it like this (implicit way), but it doesn't work

dependencies {
    implementation 'org.apache.logging.log4j:log4j-api:2.11.1'
    implementation 'org.apache.logging.log4j:log4j-core:2.11.1'
    annotationProcessor 'org.apache.logging.log4j.core:config.plugins.processor.PluginProcessor'
}

Could anyone help me?

like image 719
Anna Frolova Avatar asked Dec 23 '22 01:12

Anna Frolova


1 Answers

The answer was pretty simple:

dependencies {
    implementation 'org.apache.logging.log4j:log4j-api:2.11.1'
    annotationProcessor 'org.apache.logging.log4j:log4j-core:2.11.1'
}
like image 106
Anna Frolova Avatar answered Dec 26 '22 12:12

Anna Frolova