compileDebugJava - 不是增量式的。无法推断源目录 [英] compileDebugJava - is not incremental. Unable to infer the source directories
问题描述
自从Gradle 2.1开始,现在支持Java源码的增量编译检查
我使用下面的代码片段来启用它
afterEvaluate {
android.applicationVariants.each {variant - >
variant.javaCompile.options.incremental = true
}
}
但是我收到了警告信息,
:App:compileDebugJava - 不是增量式的。无法推断源
目录。
请告诉我该怎么做才能摆脱它。
是的,Android Build Plugin存在一个问题,请阅读此处:
我们使用自定义源代码集,因此在
停止使用它们之前,这个问题不太可能得到解决。
http://code.google.com/p/android/issues / detail?id = 82411 ,并在此提及
https://discuss.gradle.org/t/faster-incremental-builds/552/10
当它被修复时,将它用于 Android
,将其添加到 allProjects
中:
allProjects {
tasks.withType(JavaCompile){
configure(options){
increment al = true
}
}
}
如果您看到这个,你必须先建立你的项目:
compileDebugJava - 不是增量的如果你看到这个,错误的<$ c $根据isse使用c> sourceSets :
$ b
compileDebugJava - 不是增量式的。无法推断源目录。
从他们对
Java
项目的示例中:
apply plugin:'java'
compileJava {
//在单独的守护进程中启用编译
options.fork = true
//启用增量编译
options.incremental = true
}
来源: http://gradle.org/docs/current/dsl/org.gradle.api.tasks.compile.JavaCompile.html
Since Gradle 2.1, incremental compilation of Java source is now supported check this
I used below snip of code to enable it
afterEvaluate { android.applicationVariants.each { variant -> variant.javaCompile.options.incremental = true } }
But I am getting below warning message,
:App:compileDebugJava - is not incremental. Unable to infer the source directories.
Please suggest me what should I do to get rid of it
解决方案Yes, there is an issue for Android Build Plugin, read here:
We use custom sourceset so this is unlikely to be fixed until we can stop using them.
http://code.google.com/p/android/issues/detail?id=82411 and mentioned here
https://discuss.gradle.org/t/faster-incremental-builds/552/10
When it is fixed, use this for
Android
, add this inallProjects
:allProjects { tasks.withType(JavaCompile) { configure(options) { incremental = true } } }
If you see this, you must build your project first:
compileDebugJava - is not incremental (e.g. outputs have changed, no previous execution, etc.).
If you see this, the wrong
sourceSets
are being used according to the isse(see link):compileDebugJava - is not incremental. Unable to infer the source directories.
From their example for
Java
projects:apply plugin: 'java' compileJava { //enable compilation in a separate daemon process options.fork = true //enable incremental compilation options.incremental = true }
Source: http://gradle.org/docs/current/dsl/org.gradle.api.tasks.compile.JavaCompile.html
这篇关于compileDebugJava - 不是增量式的。无法推断源目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!