JSR308 Checkers Maven2 plugin

Moved!

The checkers plugin is now distributed by the JSR308 & Checkers framerwork team, see: http://types.cs.washington.edu/checker-framework/current/checkers-manual.html#maven-plugin.

Introduction

For an introduction, see the blog entry. Source code is available at GitHub.

Maven configuration

To be able to use the plugin and declare jsr308 checkers libraries as dependencies of your project, you'll have to add the following repositories to your pom.xml:

    <repositories>
        <repository>
            <id>mamut-releases</id>
            <url>http://repository.mamut.net.pl/content/repositories/releases</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>mamut-releases</id>
            <url>http://repository.mamut.net.pl/content/repositories/releases</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>        
    </pluginRepositories>

To use annotations for the standard checkers (nullness, interning, mutability) or the typestate checker, you'll need to declare dependencies:

    <dependencies>
        <!-- for using the standard checkers -->
        <dependency>
            <groupId>mamut.net.pl</groupId>
            <artifactId>checkers-quals</artifactId>
            <version>0.8.6</version>
        </dependency>
        <!-- for using the typestate checker -->
        <dependency>
            <groupId>mamut.net.pl</groupId>
            <artifactId>typestate-checker</artifactId>
            <version>0.1</version>
        </dependency>
    </dependencies>

You can also browse the whole repository here: http://repository.mamut.net.pl/content/repositories/releases/.

Plugin configuration

Below you can find all configuration options for the plugin. All of them, except processor, are optional.

    <build>
        <plugins>
            <plugin>
                <groupId>mamut.net.pl</groupId>
                <artifactId>checkersplugin</artifactId>
                <version>0.1</version>
                <executions>
                    <execution>
                        <!-- any phase after compilation, as the dependencies are then resolved -->
                        <phase>process-classes</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <!-- required configuration options -->
                    <!-- a list of processors to run -->
                    <processors>
                        <processor>checkers.nullness.NullnessChecker</processor>
                        <processor>checkers.interning.InterningChecker</processor>
                        <processor>checkers.typestate.TypestateChecker</processor>
                    </processors>
		    
                    <!-- optional configuration options -->		    
                    <!-- full path to a java executable that should be used to create the forked JVM -->
                    <executable>/opt/java1.6/bin/java</executable>
                    <!-- should an error reported by a checker cause a build failure, or only be logged as a warning; defaults to true -->
                    <failOnError>true|false</failOnError>
                    <!-- a list of patterns to include, in the standard maven syntax; defaults to **/*.java -->
                    <includes>
                        <include>org/company/important/**/*.java</include>
                    </includes>
                    <!-- a list of patterns to exclude, in the standard maven syntax; defaults to an empty list -->
                    <excludes>
                        <exclude>org/company/notimportant/**/*.java</exclude>
                    </excludes>
                    <!-- additional parameters passed to the JSR308 java compiler -->
                    <javacParams>-Alint</javacParams>
                    <!-- additional parameters to pass to the forked JVM -->
                    <javaParams>-Xdebug</javaParams>
                    <!-- versions of checkers to use; defaults to the current newest version: 0.8.6 -->
                    <checkersVersion>0.8.8</checkersVersion>  
                </configuration>
            </plugin>
            <!-- other plugins -->
        </plugins>
    </build>

More info

In case of any questions, suggestions, remarks, etc., write me at adam (at) warski (dot) org or comment on the blog.