github:git@github.com:Ryan-Miao/springboot-security-demo.git
https://www.cnblogs.com/woshimrf/p/using-checkstyle.html
gradle的checkstyle的sourceSets源码设置:
https://www.jianshu.com/p/3f59d62f9f62
记录下自己的checkstyle历程:
checkstyle.gradle
apply plugin: 'java'
apply plugin: 'checkstyle'
checkstyle {
// The version of the code quality tool to be used.
// The most recent version of Checkstyle can be found at https://github.com/checkstyle/checkstyle/releases
toolVersion = "8.8"
// The source sets to be analyzed as part of the check and build tasks.
// Use 'sourceSets = []' to remove Checkstyle from the check and build tasks.
//sourceSets = [project.sourceSets.main, project.sourceSets.test]
// Whether or not to allow the build to continue if there are warnings.
ignoreFailures = false
// Whether or not rule violations are to be displayed on the console.
showViolations = true
configProperties.projectDir=project.projectDir
checkstyleMain.configFile=new File(project.projectDir,'/config/checkstyle/google_checks.xml')
configFile file("config/checkstyle/google_checks.xml")
println "---------------------"
sourceSets {
main{
java {
//srcDir "app/src/main/java"
srcDir "device_provisioning_sdk/src/main/java"
sourceSets.all {set ->
println "${set.name} 的文件是${set.java.srcDirs}"
}
}
}
}
}
checkstyle通过java命令可以正确检查android工程的java代码,跟android库貌似没有关系,记录:
java -jar checkstyle-8.27-all.jar -c /google_checks.xml MyClass.java
应该可以经过改造放到gradle里的?
https://checkstyle.sourceforge.io/cmdline.html#Run_after_compilation
这个可以正确配置:
https://www.jianshu.com/p/11e97c5e064d
checkstyle task执行让其在android studio窗口显示:
解决:在下面的“warning”改为“error”
gradle官网:
https://docs.gradle.org/current/dsl/org.gradle.api.tasks.SourceSet.html
classpath的理解:
https://www.liaoxuefeng.com/wiki/1252599548343744/1260466914339296
gradle官方构建系统概述:
https://docs.gradle.org/current/userguide/userguide_single.html