views:

1112

answers:

2

For the last months I've been slowly improved the Eclipse automated PDE build process for our application.

The first thing I tried was automating the test cases. The next step was some scripting code to generate an installer automatically, for both linux and windows.

Now I want to add some static code analysis reports to the process. In my company we use Checkstyle for this purpose.

I understand that it is possible to automate the Checkstyle plugin in such a way that it can generate a report from the build process. It would be useful to distribute the checkstyle results together with the unit test report, which are being generated already.

Does anyone has some good example of how this can be achieved in a relatively painless way?

+1  A: 

There's a Checkstyle Ant Task defined in the Checkstyle JAR file. Use it as follows:

<taskdef resource="checkstyletask.properties" classpath="/path/to/checkstyle-all-4.4.jar"/> 

<checkstyle config="/path/to/my/checkstyle_config.xml">
  <fileset dir="src/checkstyle" includes="**/*.java"/>
</checkstyle>
Dave Webb
Thanks! The only thing to add, after I tried, is that for report generation (which is my use case) we must add failOnViolation=false to the checkstyle tag.
Mario Ortegón
A: 

You might want to look at a CI server like Hudson, which you can use to automate your builds and with which you can easily integrate a number of plugins for FindBugs, CheckStyle, etc.

Ewen Cartwright