春天的靴子 魂狩篇第二话

| 分类 MICROSERVICE  | 标签 spring  springboot  java  groovy  gradle 

In Gradle, building project which contains multi-module, there should be warning, because of code references.

warning: Implicitly compiled files were not subject to annotation processing. Use -implicit to specify a policy for implicit compilation.

To compile a set of source files, the compiler may need to implicitly load additional source files. (See Searching For Types). Such files are currently not subject to annotation processing. By default, the compiler will give a warning if annotation processing has occurred and any implicitly loaded source files are compiled. Using the javac option “-implicit” for ways to suppress the warning.

For more details, see javac, searching for types and annotation processing, and stackoverflow question.

In gradle, suppressing that warning, by adding the parameter in compileJava task

compileJava {
    sourceCompatibility = jdkLevel
    targetCompatibility = jdkLevel
    // this parameter will pass to javac
    options.compilerArgs << '-implicit:none'
    options.encoding = encoding
}

上一篇     下一篇