Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle DSL method not found: 'destination()' after update to Gradle 5.2.1

After updating to Gradle 5.2.1 my build is failing with this error:

Gradle DSL method not found: 'destination()'

I figured out that this error has something todo with my analysis.gradle

My analysis.gradle looks like that

apply plugin: 'checkstyle'
apply plugin: 'pmd'
apply plugin: 'jacoco'

jacoco {
toolVersion = "0.7.7.201606060606"
}

check.dependsOn 'checkstyle', 'pmd', 'lint'

task checkstyle(type: Checkstyle) {
println "----- checkstyle -----"
configFile file(projectDir.getAbsolutePath() + '/analysis/checkstyle-ruleset.xml')

source 'src'
source '../domain/src'
source '../util/src'
include '**/*.java'
exclude '**/gen/**'
exclude '**/java-gen/**'
exclude '**/androidTest/**'
exclude '**/test/**'

ignoreFailures = true

classpath = files()

reports {
    xml {
        destination buildDir.absolutePath + "/outputs/reports/checkstyle_report.xml"
    }
}

}

I think I have to replace the destination flag but I have no idea how to replace it.

like image 932
dudi Avatar asked Feb 13 '19 13:02

dudi


1 Answers

Before Gradle 5.0 the method setDestination(Object file) was already deprecated, see here : setDestination(Object file)

In Gradle 5.x this method has been removed, you must now use setDestination(File file) which takes a File parameter (see setDestination(File file) )

So you need to change your code into:

reports {
    xml {
        destination file("$buildDir/outputs/reports/checkstyle_report.xml")
    }
}
like image 130
M.Ricciuti Avatar answered Oct 06 '22 05:10

M.Ricciuti