web-dev-qa-db-fra.com

Impossible de trouver la méthode destination () pour les arguments sur le rapport xml de type org.gradle.api.plugins.quality.internal.findbugs.FindBugsXmlReportImpl

Après avoir mis à jour la version Android studio version 3.4.0, j'ai mis à jour la version Gradle vers 5.1.1 et essayé de reconstruire le projet, il lance une exception dans le fichier quality.gradle.

 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.

RL de chemin de classe de niveau projet Android et URL de distribution Gradle

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

J'ai essayé de faire invalider le cache et redémarrer le projet. ça continue d'échouer

Voici mon fichier 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
}

Cela se produit lorsque j'utilise la version Gradle 5.1.1 et la version 3.4.0 du chemin de classe Gradle. Plus tôt, j'utilisais Gradle 4.10.1 et la version 3.3.2 du chemin de classe.

10
Sabarinathan

Un bon exemple devrait être

 reports{
    html.enabled true
    html.destination(file("$yourpath"))
 }
 classpath = files()
0
Aveek