我有一个利用Gradle进行测试和构建的java项目。我最近不得不将我的JVM更新到1.7.0_75,以便将Maven用于另一个项目工作。
现在我回到了我的Gradle项目,我发现gradle -v返回了找不到的命令,在我使用brew install Gradle后,我的构建脚本返回以下错误:
* Where:
Build file '/Users/adamhardie/Documents/Workspace/sagepay-stub/build.gradle' line: 27
* What went wrong:
A problem occurred evaluating root project 'sagepay-stub'.
> No such property: testReport for class: org.gradle.api.tasks.testing.Test_Decorated
Possible solutions: testReporter
我已经确认build.gradle脚本自上次工作以来没有以任何方式进行过更改,那么可能导致此错误的原因是什么?
以下是似乎导致问题的部分(这是该项目的构建脚本:https://github.com/azagniotov/stubby4j)
if (project.name != 'main') {
tasks.withType(Test) {
Task testTask ->
def totalSuiteCount = 0
def successSuiteCount = 0
testReport = false
testLogging {
events /*"passed", */"skipped", "failed"
exceptionFormat "full"
showExceptions true
showCauses true
showStackTraces true
}
doFirst {
//println ""
//println "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
//println "::::: Running " + project.name.toUpperCase() + " module tests"
//println "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
}
afterSuite { testDescriptor, testResult ->
if (testDescriptor.getName().contains("$stubbyProjectGroup")) {
totalSuiteCount += testResult.getTestCount()
totalTestCounter += testResult.getTestCount()
successSuiteCount += testResult.getSuccessfulTestCount()
}
}
doLast {
println ""
println "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
println "::::: Ran " + project.name.toUpperCase() + " module tests"
println "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
println "::::: Passed (" + successSuiteCount + "/" + totalSuiteCount + ") tests"
println "::::: Total tests executed in $stubbyProjectName project so far " + totalTestCounter
println "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
println ""
}
}
}
答案 0 :(得分:1)
抱歉这么晚回复。 stubby4j最近已升级为使用Gradle 2.2.1
答案 1 :(得分:0)
似乎gradle版本被意外更改,因此出现了问题。 testReport
类的Test
已至少从 1.12 版本的gradle中弃用。
现在可以通过reports
{{1}}配置报告。{/ 3}}。