Gradle 3.1中缺少Gradle play插件属性testClassesDirs
我想使用Gradle 3.1中缺少Gradle play插件属性testClassesDirs,gradle,build.gradle,Gradle,Build.gradle,我想使用gradle3.1和Gradle播放插件。我必须添加一个任务 你能帮我把下面的代码片段从版本4.0解析到3.1? 我在Gradle 3.1中找不到类似的属性testClassesDirs task doesNotWorkIn3_1(type: Test) { dependsOn { tasks.compilePlayBinaryTests } testClassesDirs = project.files { [tasks.compilePlayBinaryTests.
gradle3.1
和Gradle播放插件
。我必须添加一个任务
你能帮我把下面的代码片段从版本4.0
解析到3.1
?
我在Gradle 3.1中找不到类似的属性testClassesDirs
task doesNotWorkIn3_1(type: Test) {
dependsOn { tasks.compilePlayBinaryTests }
testClassesDirs = project.files { [tasks.compilePlayBinaryTests.destinationDir] }
classpath = project.files { testPlayBinary.classpath }
include '**/SwaggerControllerJsonTest.class'
outputs.upToDateWhen { false }
}
正如您所说,问题在于
testClassesDirs
,它存在于Gradle4.x中,但不存在于Gradle3.1中
所以请更新
testClassesDirs=project.files{[tasks.compilePlayBinaryTests.destinationDir]}
到
让我知道这是否有效
task genSwaggerJson(type: Test) {
dependsOn { tasks.compilePlayBinaryTests }
testClassesDir = file("$buildDir/genSwaggerJson_testClasses")
classpath = files({ tasks.testPlayBinary.classpath })
outputs.upToDateWhen { false }
include '**/MySingleTest.class'
}
这一款适用于3.1版非常感谢您的回复,但没有任何帮助。我已经回答了我的问题own@Sergey我没有看到你的答案和我的答案之间的区别,错误是什么?而且,我认为你自己的答案与你原来的问题(从文件夹的角度)有所不同。
task genSwaggerJson(type: Test) {
dependsOn { tasks.compilePlayBinaryTests }
testClassesDir = file("$buildDir/genSwaggerJson_testClasses")
classpath = files({ tasks.testPlayBinary.classpath })
outputs.upToDateWhen { false }
include '**/MySingleTest.class'
}