The JacocoReportBase.setClassDirectories (FileCollection) method has been deprecated.

phenomenon

If you exclude certain classes from JaCoCo's reporting, as follows:

    jacocoTestReport {
        reports {
            html.enabled = true
            xml.enabled = true
        }
        afterEvaluate {
            //Exclude automatically generated classes from coverage aggregation
            classDirectories = files(classDirectories.files.collect {
                fileTree(dir: it, exclude: [
                    '**/_*.class', '**/*DaoImpl.class'
                ])
            })
        }

Gradle 6.0 warns you that JacocoReportBase # setClassDirectories will be deprecated.

The JacocoReportBase.setClassDirectories(FileCollection) method has been deprecated. This is scheduled to be removed in Gradle 6.0. Use getClassDirectories().from(...)
        at build_e2otrmuro5f5yvbdc9709fstk$_run_closure1$_closure10$_closure16.doCall(/path/to/build.gradle:46)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)

Confirmation environment

How to fix

Rewrite using JacocoReportBase # getClassDirectories as the warning message indicates. Gradle power is low, and I feel like I'm googled every time just to correct it according to the warning message ...

diff --git a/build.gradle b/build.gradle
index 54b418e84..be6bd6966 100644
--- a/build.gradle
+++ b/build.gradle
@@ -43,7 +43,7 @@ allprojects { subproj ->
         }
         afterEvaluate {
             //Exclude automatically generated classes from coverage aggregation
-            classDirectories = files(classDirectories.files.collect {
+            classDirectories.from = files(classDirectories.files.collect {
                 fileTree(dir: it, exclude: [
                     '**/_*.class', '**/*DaoImpl.class'
                 ])

Recommended Posts

The JacocoReportBase.setClassDirectories (FileCollection) method has been deprecated.
About the method
The date time of java8 has been updated
Output about the method # 2
Kotlin 1.3.50 has been released !!
About the length method
Macchinetta has been released
About the authenticate method.
About the map method
About the ancestors method
About the to_s method.