Dev/Java

[Gradle] Using the Gradle PMD Plugin for Static Code Analysis

마이스토리 2016. 6. 9. 17:43

> Using the Gradle PMD Plugin for Static Code Analysis

> plugin 추가 [build.gradle파일]

apply plugin: 'pmd'


pmd {

toolVersion = '5.4.1'

  ruleSetConfig = rootProject.resources.text.fromFile('etc/pmd/ruleset.xml')

  ignoreFailures = true

}


> ruleset.xml 파일 생성

ruleset.xml


> build task 실행

> gradlew clean build


결과]

* build/reports/pmd 디렉토리 및 결과물 생성됨


* 기존 build/reports/buildDashboard/index.html 에 PMD 리포트 페이지 링크 생성됨



* PMD 결과 리포트 확인