android - Gradle 插件(findbugs、pmd、jdepend、checkstyle)不工作

标签 android gradle findbugs pmd

我的项目有以下应用 bulild.gradle。当我运行命令 gradle check 时,app/build/ 文件夹中没有报告任何输出。我基本上对以前的项目使用了相同的代码,它似乎工作得很好。

apply plugin: 'com.android.application'
apply plugin: "findbugs"
apply plugin: 'pmd'
apply plugin: "jdepend"
apply plugin: 'checkstyle'

findbugs {
    ignoreFailures = false
    effort = "max"
    reportLevel = "low"
}

pmd {
    ignoreFailures = true
}

jdepend{
    ignoreFailures = true
}

tasks.withType(FindBugs) {
    reports {
        xml.enabled = false
        html.enabled = true
    }
}

tasks.withType(Checkstyle) {
    reports {
        xml.enabled false
        html.enabled true
        html.stylesheet resources.text.fromFile('config/xsl/checkstyle-custom.xsl')
    }
}

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.0"
    defaultConfig {
        applicationId "dat255.refugeeevent"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.google.android.gms:play-services:9.6.1'
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.android.support:design:24.2.1'
    compile 'com.android.support:support-v4:24.2.1'
    compile 'com.google.code.gson:gson:2.7'
    testCompile 'junit:junit:4.12'
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile 'com.github.bumptech.glide:glide:3.5.2'
    compile files ('libs/microsoft-translator-java-api-0.6.2-jar-with-dependencies.jar')
}

最佳答案

查看 gradle fury 的质量插件,适用于 android 和非 android 项目 https://github.com/gradle-fury/gradle-fury .我们使用它有一些强制报告站点的插件。它主要基于其他人的工作,并进行了大量调整,使其在 Android 和非 Android 项目中都能正常工作。

应用它 所有项目{ 申请自:“https://raw.githubusercontent.com/gradle-fury/gradle-fury/master/gradle/quality.gradle” }

然后你需要这里的内容:https://github.com/gradle-fury/gradle-fury/tree/master/config克隆到你的仓库中。只需 config 文件夹,其余内容不需要。

最后,要么调用任何需要检查的 gradle 任务。所以以下任何一项都可以解决问题

  • gradlew 构建
  • gradlew 检查
  • gradlew install(如果你正在运行来自 fury 的 maven 支持)

关于android - Gradle 插件(findbugs、pmd、jdepend、checkstyle)不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40004876/

相关文章:

android - 您可以从命令行通过 Gradle 部署到设备吗

gradle - React-Native ProductFlavors(错误类型 3 : Activity class does not exist)

java - 避免警告 "boxing immediately unboxed to perform coercion"

java - Findbugs 警告 : Integer shift by 32 -- what does it mean?

android - 应用程序功能要求保存信用卡详细信息以备将来使用。需要调查是否存在任何特定的安全设计

android - SQLite 在 where 子句和分组依据中使用带有日期函数的年份

android - 使用 Firebase 时,GoogleSignIn 被标记为内部登录,不应从应用访问

android - RelativeLayout中不能存在循环依赖项吗?

Gradle已从服务器: Forbidden接收到状态码403

java - 使用自定义 FindBugs 插件扩展 SonarQube FindBugs 插件