hudson + maven + PMD plugin

Hudson에 연결한 maven 프로젝트에 PMD 플러그인을 설정해 본다.

우선 프로젝트의 confiruation에서 Publish PMD analysis results를 체크한다.


그리고, 설정을 저장한 다음 Build Now 해보자.
변화가 없다.

pom.xml을 바꾸자.
dependency 부분에 pmd plugin 선언을 하고,

               
        
            org.apache.maven.plugins
            maven-pmd-plugin
        


reporting 부분에 pmd 관련 설정을 기록한다. 이 때, PMD에서 검사하는 ruleset도 함께 지정한다. 만약, annotation 등을 썼다면, jdk 버전이 문제가 될 수 있으므로,
configuration에 jdk 버전도 함께 명시하자.

        
        
            org.apache.maven.plugins
            maven-pmd-plugin
            
                utf-8
                1.6
                
                    /rulesets/basic.xml
                    /rulesets/unusedcode.xml
                    /rulesets/junit.xml
                
            
        


Build 옵션 중
Goals and options에 pmd:pmd를 추가로 적어주자.



이제 Build Now를 하고 결과를 보자.
정상적으로 실행되었다면,  다음과 같이 왼쪽 메뉴에 PMD 관련 메뉴가 추가된 것을 확인할 수 있다.

 
PMD Warnings를 클릭하면, 세부 사항이 나타난다.


 

댓글

Designed by JB FACTORY