Skip to main content
Last updated March 31, 2011 09:38, by Amanj Sherwany
Feedicon  

Using Loci as a Maven Plugin

If your project uses Maven, you can use Loci to type check it, by adding the following parts to your pom.xml

1- First you need to declare Loci as a dependency:

    <dependencies>
        <!-- Loci annotation processor -->
        <dependency>
            <groupId>net.java.loci</groupId>
            <artifactId>loci</artifactId>
            <version>0.1</version>
        </dependency>

        <!-- other dependencies -->
    </dependencies>

2- And finally, you need to attach the plugin to your build lifecycle:

        <build>
            <plugins>
                <plugin>
                    <groupId>net.java.loci</groupId>
                    <artifactId>loci-plugin</artifactId>
                    <version>0.1</version>
                    <executions>
                        <execution>
                            <!-- run Loci after compilation; this can also be any later phase -->
                            <phase>process-classes</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <!-- required configuration options -->

                        <!-- other optional configuration -->
                        <!-- 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 Loci 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 JSR308 to use; defaults to the current newest version: 1.1.2, You cannot provide pre (1.1.2) -->
                        <jsrVersion>1.1.2</jsrVersion>
                    </configuration>
                </plugin>
            </plugins>
            <!-- other plugins -->
        </build>
The plugin was contributed by Adam Warski to the Checker framework team, and Amanj Sherwany forked it to suit Loci's need.

 
 
Close
loading
Please Confirm
Close