Sunday, September 21, 2014

Maven tips : Disabling PMD, CPD and Checkstyle violation

In big companies, it is quite common to follow best practice of the industry.
PMD and  Checkstyle is one of those utilities which help us to achieve it.

But sometime this small utility act as a hindrance for normal day to day development work.

Specially when you quick test a something.

It really irritates me when I make a small change and want to test whether it works or not and my build fails due to PMD or Checkstyle error.

There may be many fix for it. But I know two:
1) Make change in your pom.xml for it.
2) Use maven command option for it.

I prefer the 2nd one as you don't have to change your pom and will provide the detail about the same:

To disable style check:


-Dcheckstyle.skip=true 

e.g :            mvn  -Dcheckstyle.skip=true  install

To disable pmd violation check :


-Dpmd.failOnViolation=false

mvn  -Dpmd.failOnViolation=false   install

To disable Copy/Paste Detector (CPD) violation check:

 -Dcpd.failOnViolation=false

 mvn  -Dcpd.failOnViolation=false   install




No comments:

Post a Comment