Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gradle 3.1中缺少Gradle play插件属性testClassesDirs_Gradle_Build.gradle - Fatal编程技术网

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'
}