Open pra91 opened 3 years ago
When using the syntax for multiple checks, one has to specify the coverage type:
scoverage {
check {
minimumRate = 0.5
coverageType = CoverageType.Statement
}
}
If no multiple checks are required, then it is possible to specify just the minimum rate:
scoverage {
minimumRate = 0.5
}
If the problem still persists after fixing the syntax, please add the output ./gradlew --version
as well.
I am still having the same problem with
scoverage {
minimumRate = 0.5
}
gradle output below:
------------------------------------------------------------
Gradle 6.8
------------------------------------------------------------
Build time: 2021-01-08 16:38:46 UTC
Revision: b7e82460c5373e194fb478a998c4fcfe7da53a7e
Kotlin: 1.4.20
Groovy: 2.5.12
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 1.8.0_302 (Amazon.com Inc. 25.302-b08)
OS: Mac OS X 11.6 x86_64
I was able to reproduce the issue and it seems to be a problem with moving from Gradle 6 to 7.
Running a sample project with Gradle 6.8 and AdoptOpenJDK 11 yields the error:
Caused by: java.lang.AbstractMethodError: Receiver class org.scoverage.ScoverageExtension$CheckConfig does not define or inherit an implementation of the resolved method 'abstract java.lang.Object getProperty(java.lang.String)' of interface groovy.lang.GroovyObject.
at org.scoverage.ScoveragePlugin$_configureCheckTask_closure8$_closure46$_closure47.doCall(ScoveragePlugin.groovy:343)
Upgrading to Gradle 7 in the project resolves the issue; alternatively, using the plugin version before 6 also seems to resolve the issue.
It looks like moving the plugin to be built with Gradle 7 instead of 6, which was included in version 6 of the plugin (see diff between 5 and 6), broke the plugin for builds with Gradle version less than 7.
This looks to be a problem with Gradle as can be seen in other plugins here and here.
I'll see about opening a ticket in the Gradle repository. For now, @pra91, can you upgrade your Gradle to 7 and see if it helps?
When using 7.0.0 of the plugin I am unable to run checkScoverage in my builds.
running ./gradlew checkScoverage runs my test cases but then fails with the following stacktrace. Running reportScoverage works as expected
Gradle file: