Dev/Java

[Gradle] Using the Gradle Checkstyle Plugin for Code Style Reporting

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

> Using the Gradle Checkstyle Plugin for Code Style Reporting

> plugin 추가 및 설정

apply plugin: 'checkstyle'


checkstyle {

toolVersion = checkstyleVersion

config = rootProject.resources.text.fromFile('etc/checkstyle/rules.xml')

}


> rules.xml 파일 생성

rules.xml

> build task 실행

> gradlew clean build


결과>

* 아래와 같이 build/reports/checkstyle 디렉토리 및 결과물 생성


* 기존 buildDashBoard/index.html 에 checkstyle report 페이지 링크 생성

* 아래와 같이 checkstyle report 확인




[참고]

google code style guide

https://github.com/google/styleguide