在少数sbt项目中,我们需要一个protobuf/grpc编译,并且因为只有Gradle对此提供了常规支持,所以我们仅使用Gradle来完成与protobuf相关的任务。
有时,它会随机失败地编译相同的事物,并且会成功重试,我们确定这是由于Java增量编译所致。
我想禁用各种孵化功能和增量编译,我希望这件事具有确定性。
为此,我尝试
compileJava {
//enable compilation in a separate daemon process
options.fork = false
//enable incremental compilation
options.incremental = false
}
但是Gradle仍然会提供这样的输出(显然忽略了这些标志)
Parallel execution is an incubating feature.
Incremental java compilation is an incubating feature.
:deleteGeneratedSource
:clean
:extractIncludeProto
:extractProto UP-TO-DATE
:generateProto
:recompileProto
那么,如何禁用并行执行和增量Java编译?
最佳答案
尝试添加
org.gradle.daemon=false
org.gradle.parallel=false
到
gradle.properties
文件,它可以帮助您解决问题。