Wednesday, August 29, 2012

FindBugs Custom Detector -Build Failure - com.sun.tools.javac.code.Symbol$CompletionFailure

I was working today on a plug-in for FindBugs, writing CustomDetectors for finding some security vulnerabilities. I was able to compile the project and create the plug-in in Eclipse IDE. However, when I started working on creating a basic Ant build file, the compile target failed miserably. The error I was seeing in the Eclipse IDE was:


Buildfile: C:\Users\msubbarao\workspace\FindBugs_Cigital_Plugin\build.xml
clean:
init:
compile:
    [javac] C:\Users\msubbarao\workspace\FindBugs_Cigital_Plugin\build.xml:32: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 8 source files to C:\Users\msubbarao\workspace\FindBugs_Cigital_Plugin\bin
    [javac] An exception has occurred in the compiler (1.6.0_24). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport)  after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report.  Thank you.
    [javac] com.sun.tools.javac.code.Symbol$CompletionFailure: class file for javax.annotation.meta.When not found

BUILD FAILED
C:\Users\msubbarao\workspace\FindBugs_Cigital_Plugin\build.xml:32: Compile failed; see the compiler error output for details.

Total time: 1 second

A quick search on the web, and after adding the jsr305.jar to the classpath, the compilation error was gone.


Buildfile: C:\Users\msubbarao\workspace\FindBugs_Cigital_Plugin\build.xml
clean:
init:
compile:
    [javac] C:\Users\msubbarao\workspace\FindBugs_Cigital_Plugin\build.xml:32: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 8 source files to C:\Users\msubbarao\workspace\FindBugs_Cigital_Plugin\bin
jar:
      [jar] Building jar: C:\Users\msubbarao\workspace\FindBugs_Cigital_Plugin\FindBugs_Cigital_Plugin.jar
     [copy] Copying 1 file to C:\dev\eclipse\plugins\edu.umd.cs.findbugs.plugin.eclipse_2.0.1.20120712\plugin
BUILD SUCCESSFUL
Total time: 1 second
For more details on FindBugs visit, FindBugs Site.

Stay tuned for detailed posts on how to write CustomDetectors for FindBugs. 

No comments:

Post a Comment