Thursday, December 23, 2010

Getting JSR 308 Type Annotations Compiler working under Maven

Carrying on with the JSR 308 Type Annotations compiler, the instructions are out of date for Maven too.
I finally got it working after a fashion. I think the plugin is irredeemably about of date without editing it and recompiling. Hopefully this will get done at some point in the future, but until then I got it working by making the following changes.
Firstly, the groupId has changed to types.checkers in the repository, so the dependencies should be:


<dependency>
<groupid>types.checkers</groupid>
<artifactid>checkers-quals</artifactid>
<version>1.1.1</version>
</dependency>
Next as the plugin is broken you need to put an explicit link to the jsr308-all.jar location (which isn't very maven-like, but works).


<build>
<plugins>
<plugin>
<groupid>org.apache.maven.plugins</groupid>
<artifactid>maven-compiler-plugin</artifactid>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<fork>true</fork>
<executable>C:\Program Files\Java\jdk1.7.0\bin\javac.exe</executable>
<compilerargument>-Xbootclasspath/p:C:\Projects\units\checker-framework\checkers\binary\jsr308-all.jar</compilerargument>
<compilerarguments>
<processor>checkers.nullness.NullnessChecker</processor>
</compilerarguments>
</configuration>
</plugin>
</plugins>
</build>

2 comments:

Anonymous said...

Superb post! I wish i had the writing abilities you had. Anyway, thanks for Iyour hard work, please maintain it up.

dembol said...

Hello,

I've written new jsr-308 checkers plugin for maven 2 because the original plugin seems to be broken (i'm unable to download plugin from repository.mamut.net.pl).

Go to http://devesion.com/jsr308-checkers-plugin/ if you want to use it. Enjoy.