Tuesday, January 19, 2010

Sonar Not Running?

Scenario
You've got Hudson or another CI system setup for your project and your trying to track code quality with Sonar but you start getting build failures and Sonar isn't running.

The Problem
By default maven will fail a build if there are test failures. When Sonar tries to execute sensors like FindBugs that analyze at the bytecode level it will fail before decorating and saving the results. 

Solution
Setting maven.test.failure.ignore=true will allow Sonar to run even if there are test failures which actually works out nice since that is something you want to trend anyways.




Note
Setting maven.test.failure.ignore=true is obviously not something you want to do for a production build but you shouldn't be waiting for a production build to trend code quality anyways. If you are another option would be to setup another build (or a downstream project in Hudson) that ignores test failures.  

No comments:

Post a Comment