25 lines
848 B
Groovy
25 lines
848 B
Groovy
apply plugin: "pmd"
|
||
|
||
def pmdConfigPath = rootProject.file("codequality").path
|
||
|
||
task pmd(type:Pmd){
|
||
//忽略失败,如果设置为true,检测出bug会停止task
|
||
ignoreFailures = false
|
||
consoleOutput = true
|
||
//filter路径
|
||
ruleSetFiles = files("${pmdConfigPath}/custom-pmd-ruleset.xml") //新增rules
|
||
ruleSets = []
|
||
//检测资源路径
|
||
source 'src/main/java','src/jinlvvan/java','src/driverm1/java'
|
||
//排除项
|
||
exclude '**/gen/**'
|
||
|
||
reports {
|
||
xml.getRequired().set(false)
|
||
html.getRequired().set(true)
|
||
//结果输出到项目根目录下的 build/reports/pmd 文件夹中,只需要html格式的结果文档
|
||
def destination = new File(new File("${project.rootProject.buildDir.path}/reports/pmd"), "${project.name}-pmd.html")
|
||
html.destination(destination)
|
||
}
|
||
|
||
} |