Skip to content
Advertisement

Gradle build failing after updating to Gradle 1.2.2

I have a java project that utilizes Gradle for testing and building. I recently had to update my JVM to 1.7.0_75 to use Maven for another project for work.

Now I have gone back to my Gradle project, I found that gradle -v was returning command not found, and after I used brew install Gradle, my build script returns the following error:

* 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

I have confirmed the build.gradle script has not been altered in any way since it was last working, so what could be the possible cause of this error?

Below is the part that seems to be causing issues ( it is the build script for this project: 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 ""
        } 
  }    
}

Advertisement

Answer

It seems that gradle version was changed by accident and thus the problems. testReport for Test class is deprecated from at least 1.12 version of gradle.

Now reports can be configured via reports as stated here.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement