我想整合checkstyle與Android項目 - 我的build.gradle在下面。我想基本上看到警告標識缺少構建文檔的代碼。使用這個配置,我看到一個名爲checkstyle的gradle任務,我可以手動執行,但在重建項目時不會調用它(即使我右鍵單擊該任務並說重建時執行)我怎樣才能執行checkstyle每當我建立一個Android應用程序
我必須缺少因爲它看起來像其他人有完全相反的問題,並試圖阻止它在構建上運行。我究竟做錯了什麼?
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
apply plugin: 'checkstyle'
task checkstyle(type: Checkstyle) {
configFile file("${project.rootDir}/config/checkstyle/checkstyle.xml")
source 'src'
include '**/*.java'
exclude '**/gen/**'
reports {
xml.enabled = true
}
classpath = files()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
你打算存檔什麼?在每個構建上運行checkstyle? – Divers