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

。_饼干妹妹 提交于 2019-11-28 07:09:53

问题


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.


回答1:


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")
    }
}



回答2:


All adjustment was done in my quality.gradle. Check config folder for quality.gradle file and change all usage of

destination "$reportsDir/pmd/pmd.xml"

to

destination file("$reportsDir/pmd/pmd.html")



来源:https://stackoverflow.com/questions/54671249/gradle-dsl-method-not-found-destination-after-update-to-gradle-5-2-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!