Gradle 生成源
Gradle generate soruce
我用Gradle4.6
compile(...)
annotationProcessor(...)
java.gradle
def generatedDir = new File(buildDir, "generated/source")
apply plugin: "java"
sourceSets {
main.java.srcDirs = ["$generatedDir/main", "src/main/java"]
main.resources.srcDir "src/main/resources"
test.java.srcDirs = ["$generatedDir/test", "src/test/java"]
test.resources.srcDir "src/test/resources"
}
compileJava {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
options.encoding = "UTF-8"
options.compilerArgs = ["-Xlint:unchecked"]
dependsOn(processResources)
}
test {
systemProperties = System.properties
}
我有 /build/generated/source/apt/main 和 /build/generated/source/apt/test
我可以建议如何配置来自 gradle 的插件 idea,以便 Idea 看到生成的文件
我把net.ltgt.apt改成了net.ltgt.apt-idea
我用Gradle4.6
compile(...)
annotationProcessor(...)
java.gradle
def generatedDir = new File(buildDir, "generated/source")
apply plugin: "java"
sourceSets {
main.java.srcDirs = ["$generatedDir/main", "src/main/java"]
main.resources.srcDir "src/main/resources"
test.java.srcDirs = ["$generatedDir/test", "src/test/java"]
test.resources.srcDir "src/test/resources"
}
compileJava {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
options.encoding = "UTF-8"
options.compilerArgs = ["-Xlint:unchecked"]
dependsOn(processResources)
}
test {
systemProperties = System.properties
}
我有 /build/generated/source/apt/main 和 /build/generated/source/apt/test
我可以建议如何配置来自 gradle 的插件 idea,以便 Idea 看到生成的文件
我把net.ltgt.apt改成了net.ltgt.apt-idea