使用注解处理器和log4j2 PluginProcessor配置Gradle

时间:2019-01-29 17:01:24

标签: gradle annotations

我试图用gradle构建我的项目。我收到此错误:

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

我知道必须使用annotattionProcessor而不是进行编译。但是实际上是怎么做的。 这是我的gradle文件依赖项的一部分:

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

我试图以这种方式(隐式方式)使用它,但是它不起作用

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'
}

有人可以帮助我吗?

1 个答案:

答案 0 :(得分:1)

答案很简单:

x = np.arange(1, 10000)
y = -np.log(x/10000.0)