今天看着项目,想着使用黄油刀省点事儿,配置好黄油刀之后,悠哉的点击了一下运行,突然报了一个异常,如下:
Error:java.lang.RuntimeException: Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor. Please add them to the annotationProcessor configuration.
经过排查,发现是Gradle引发的异常,这里大体说明下:
新的 gradle 插件不再支持 annotation processors,如果需要使用需要显式声明
So,解决办法如下:
defaultConfig {
...
javaCompileOptions {
// 显式声明支持注解
annotationProcessorOptions {
includeCompileClasspath true
}
}
}
原博主之前写的配置是
includeCompileClasspath false