我有一个使用 Gradle 进行测试和构建的 java 项目。我最近不得不将我的 JVM 更新到 1.7.0_75 才能将 Maven 用于另一个工作项目。
现在我回到我的 Gradle 项目,我发现 gradle -v 正在返回 command not found,在我使用 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 ""
}
}
}