在org.gradle.api.plugins.quality.internal.findbugs.FindBugsXmlReportImpl类型的Report xml上找不到参数的方法destination() [英] Could not find method destination() for arguments on Report xml of type org.gradle.api.plugins.quality.internal.findbugs.FindBugsXmlReportImpl

查看:200
本文介绍了在org.gradle.api.plugins.quality.internal.findbugs.FindBugsXmlReportImpl类型的Report xml上找不到参数的方法destination()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在将android studio版本更新为3.4.0之后,我将Gradle版本更新为5.1.1,并尝试重建该项目,该项目在quality.gradle文件中引发了异常.

After updating the android studio version to 3.4.0 I updated the Gradle version to 5.1.1 and tried rebuilding the project it is throwing an exception in quality.gradle file.

 Task failed with an exception.
-----------
* Where:
Script '/home/Desktop/workplace/testProject/quality/quality.gradle' line: 35

* What went wrong:
A problem occurred evaluating script.
> Could not find method destination() for arguments [/home/Desktop/workplace/testProject/app/build/reports/findbugs/findbugs.xml] on Report xml of type org.gradle.api.plugins.quality.internal.findbugs.FindBugsXmlReportImpl.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Android项目级别的类路径URL和Gradle分发URL

classpath'com.android.tools.build:gradle:3.4.0' distributionUrl = https://services.gradle.org/distributions/gradle-5.1.1-all.zip

classpath 'com.android.tools.build:gradle:3.4.0' distributionUrl=https://services.gradle.org/distributions/gradle-5.1.1-all.zip

我尝试使缓存无效并重新启动项目.它不断失败

I tried doing invalidate the cache and restart the project. it keeps failing

这是我的quality.gradle文件

apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'checkstyle'
apply plugin: 'findbugs'
apply plugin: 'pmd'

task checkstyle(type: Checkstyle) {
    configFile file("${project.rootDir}/quality/checkstyle/checkstyle.xml")
    configProperties = [
            'checkstyle.cache.file': rootProject.file('build/checkstyle.cache'),
            'checkstyleSuppressionsPath': file("${project.rootDir}/quality/checkstyle/suppressions.xml").absolutePath
    ]
    source 'src'
    include '**/*.java'
    exclude '**/gen/**'
    exclude '**/commons/**' //exclude copied stuff from apache commons
    classpath = files()
}

task findbugs(type: FindBugs) {
    ignoreFailures = false
    effort = "max"
    reportLevel = "high"
    excludeFilter file("${project.rootDir}/quality/findbugs/findbugs-filter.xml")
    classes = fileTree('build/intermediates/classes/')

    source 'src'
    include '**/*.java'
    exclude '**/gen/**'

    reports {
        xml.enabled = false
        html.enabled = true
        xml {
            destination "$project.buildDir/reports/findbugs/findbugs.xml"
        }
        html {
            destination "$project.buildDir/reports/findbugs/findbugs.html"
        }
    }

    classpath = files()
}

task pmd(type: Pmd) {
    ignoreFailures = false
    ruleSetFiles = files("${project.rootDir}/quality/pmd/pmd-ruleset.xml")
    ruleSets = []

    source 'src'
    include '**/*.java'
    exclude '**/gen/**'

    reports {
        xml.enabled = false
        html.enabled = true
        xml {
            destination "$project.buildDir/reports/pmd/pmd.xml"
        }
        html {
            destination "$project.buildDir/reports/pmd/pmd.html"
        }
    }
}

check.doLast {
    project.tasks.getByName("checkstyle").execute()
    project.tasks.getByName("findbugs").execute()
    project.tasks.getByName("pmd").execute()
    project.tasks.getByName("lint").execute()
}

checkstyle {
    toolVersion '6.17'    // set Checkstyle version here
}

当我使用Gradle版本5.1.1和Gradle类路径版本3.4.0时会发生这种情况.之前我使用的是Gradle 4.10.1和类路径3.3.2.

This is happening when I use the Gradle version 5.1.1 and Gradle classpath version 3.4.0. Earlier I was using Gradle 4.10.1 and classpath version 3.3.2.

推荐答案

在Gradle 5.x中,setDestination(Object file)已被删除 您必须使用

In Gradle 5.x setDestination(Object file) has been removed instead you must use

setDestination(File file)

,它带有File参数 因此,而不是

which takes a File parameter so instead of

destination "$yourpath"

destination file("$yourpath")

检查 gradle doc

这篇关于在org.gradle.api.plugins.quality.internal.findbugs.FindBugsXmlReportImpl类型的Report xml上找不到参数的方法destination()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆