未找到Gradle DSL方法:';目的地()';更新至Gradle 5.2.1后
更新到Gradle 5.2.1后,我的构建失败,出现以下错误:未找到Gradle DSL方法:';目的地()';更新至Gradle 5.2.1后,gradle,android-gradle-plugin,build.gradle,Gradle,Android Gradle Plugin,Build.gradle,更新到Gradle 5.2.1后,我的构建失败,出现以下错误: Gradle DSL方法未找到:“destination()” 我发现这个错误与我的分析有关。gradle 我的analysis.gradle看起来就是这样 apply plugin: 'checkstyle' apply plugin: 'pmd' apply plugin: 'jacoco' jacoco { toolVersion = "0.7.7.201606060606" } check.dependsOn 'chec
Gradle DSL方法未找到:“destination()”
我发现这个错误与我的分析有关。gradle
我的analysis.gradle
看起来就是这样
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"
}
}
}
我想我必须替换
目的地
标志,但我不知道如何替换它 在Gradle 5.0之前,方法setDestination(对象文件)
已被弃用,请参见此处:
在Gradle 5.x中,此方法已被删除,您现在必须使用setDestination(File File)
来获取File
参数(请参阅)
因此,您需要将代码更改为:
reports {
xml {
destination file("$buildDir/outputs/reports/checkstyle_report.xml")
}
}
在Gradle 5.0之前,方法
setDestination(对象文件)
已被弃用,请参见此处:
在Gradle 5.x中,此方法已被删除,您现在必须使用setDestination(File File)
来获取File
参数(请参阅)
因此,您需要将代码更改为:
reports {
xml {
destination file("$buildDir/outputs/reports/checkstyle_report.xml")
}
}
所有调整均在my
quality.gradle中完成。检查配置文件夹中的quality.gradle
文件,并更改
目标“$reportsDir/pmd/pmd.xml”
到
目标文件($reportsDir/pmd/pmd.html)
所有调整均在myquality.gradle中完成。检查配置文件夹中的quality.gradle
文件,并更改
目标“$reportsDir/pmd/pmd.xml”
到
目标文件($reportsDir/pmd/pmd.html)
谢谢你的快速回复。我已经尝试了您的建议,但遇到了以下错误:无法创建根模块:config{/Users/fooUser/Projects/analysis/checkstyle ruleset.xml},classpath{null}。这是您的规则集文件的正确路径吗/Users/fooUser/Projects/analysis/checkstyle ruleset.xml
。配置文件本身也可能有问题(版本不兼容?您应该尝试使用简单/最新的配置文件,以确保)。我已将checkstyle和pmd的规则集从analysis
文件夹移动到config
文件夹。现在一切都好了。非常感谢。我有完全相同的问题,这解决了它。谢谢谢谢你的快速回复。我已经尝试了您的建议,但遇到了以下错误:无法创建根模块:config{/Users/fooUser/Projects/analysis/checkstyle ruleset.xml},classpath{null}。这是您的规则集文件的正确路径吗/Users/fooUser/Projects/analysis/checkstyle ruleset.xml
。配置文件本身也可能有问题(版本不兼容?您应该尝试使用简单/最新的配置文件,以确保)。我已将checkstyle和pmd的规则集从analysis
文件夹移动到config
文件夹。现在一切都好了。非常感谢。我有完全相同的问题,这解决了它。谢谢