简体   繁体   English

如何找到依赖项提供注释处理器

[英]How to find dependency providing annotation processor

I am running a build with latest Gradle version (v4.6) in a project with a lot of classpath dependencies. 我正在具有很多类路径依赖项的项目中运行具有最新Gradle版本(v4.6)的构建。 I get: 我得到:

Putting annotation processors on the compile classpath has been deprecated and is scheduled to be removed in Gradle 5.0. 将注解处理器放在编译类路径上已被弃用,并计划在Gradle 5.0中删除。 Please add them to the processor path instead. 请改为将它们添加到处理器路径。

How can I find the offending dependency/ies (in a reasonable way)? 如何找到合理的违规依存关系?

The best way I found so far is to add-hoc the following code myself to the build script: 到目前为止,我发现的最好方法是自己将以下代码添加到构建脚本中:

tasks.withType(JavaCompile) {
    doFirst {
        effectiveAnnotationProcessorPath.each { maybeJar ->
            if (maybeJar.file) {
                println "Doing: " + maybeJar.name
                zipTree(maybeJar).matching {
                    include 'META-INF/services/javax.annotation.processing.Processor'
                } each {
                    processorConfigFile -> 
                    println "Annotation processor(s) found in $maybeJar.name:"
                    println processorConfigFile.filterLine { it =~ /^(?!#)/ }
                }
            }
        }
    }
}

(based on this Gradle forum answer ) (基于此Gradle论坛答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM