How to use Checkstyle and Emma
Checkstyle
Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. Maven-checkstyle plugin has been added into jcr/core/pom.xml. It checks our source code style according to java code (and some other) conventions. All the settings are default for now (there are just max line length changed, current:120, must be:80). All the checks are easy to configuring.Usage
Go to jcr/trunk/component/core, runmvn checkstyle:checkstyle
Configuration
Checkstyle configuration file is placed in jcr/trunk/component/core/src/test/resources/exo-checkstyle-checker.xml See pom.xml,... <report> ...
<module name="LineLength"> <property name="max" value="120"/> <property name="severity" value="warning"/> </module>
Emma
Emma is a free open source tool for code coverage statistics. I think Emma is the best open source tool for these purposes. We are using Emma to know how fully tests are covering our code.Usage
- Update maven-surefire-plugin version, replace
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.0</version><plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3</version>...
<!-- systemProperties>
<property>
<name>test.repository</name>
<value>db1</value>
</property>
...... <!-- execution> <id>0</id> ...
... <!-- execution> <id>2</id> ...
<!-- execution> <id>1</id> ...
... <includes> <include>**/init/TestAll.java</include> ...
mvn -Dexo.test.skip=false clean test- Tests compilation.
- Instrumentation of generated classes by Emma . There are some classes excluded from instrumentation path because they are not contain debug info.
- Tests running by surefire plugin. If you are running TCK tests make sure you have test data, tag
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
...
<execution>
<id>1</id>
...- Emma report generation.
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
...
<execution>
<id>0</id>
...
<execution>
<id>2</id>
...mvn -Dexo.test.skip=false clean test checkstyle:checkstyle
on 08/08/2007 at 12:44