如何使用gradle配置intellij注释处理器路径?

时间:2018-08-17 11:19:44

标签: annotation-processing annotation-processor

我将eclipse配置为使用注释处理器,如下所示:

eclipse {
jdt {
    apt {
        // whether annotation processing is enabled in Eclipse
        aptEnabled = compileJava.aptOptions.annotationProcessing

        // where Eclipse will output the generated sources; value is interpreted as per project.file()
        // TODO: to be changed in SaaS project
        genSrcDir = file('generatedResourcesEclipse')

        // whether annotation processing is enabled in the editor
        reconcileEnabled = true
    }
}

// Choose annotation processors jar files
factorypath {
    file {
        whenMerged { factorypath -> ['libs/SwaggerSpecsProcessor.jar']
        }
    }
}

我无法对IntelliJ做同样的事情,到目前为止,我的情况如下:

idea {
project {
    // experimental: whether annotation processing will be configured in the IDE; only actually used with the 'idea' task.
    configureAnnotationProcessing = true
}
module {
    apt {
        // whether generated sources dirs are added as generated sources root
        addGeneratedSourcesDirs = true
        // whether the annotationProcessor/apt and testAnnotationProcessor/testApt dependencies are added as module dependencies
        addAptDependencies = false

        // The following are mostly internal details; you shouldn't ever need to configure them.
        // whether the compileOnly and testCompileOnly dependencies are added as module dependencies
        addCompileOnlyDependencies = false // defaults to true in Gradle < 2.12
        // the dependency scope used for apt and/or compileOnly dependencies (when enabled above)
        mainDependenciesScope = "PROVIDED"
        // defaults to "COMPILE" in Gradle < 3.4, or when using the Gradle integration in IntelliJ IDEA
    }
}

}

在eclipse中,如何更改输出目录并选择注释处理器的工厂路径非常简单明了。我尝试过很多与intelliJ接触的方法,但到目前为止还没有运气。

0 个答案:

没有答案