[ http://jira.codehaus.org/browse/MFINDBUGS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=265370#action_265370 ]
Thomas Traber commented on MFINDBUGS-142: ----------------------------------------- Thank you for pointing out this alternative. Even though I would rather like to stick with the above described approach, I tried your alternative and now Findbugs finds the plugin. But unfortunately with the alternative the next problem pops up: While findbugs:gui starts up fine and reports all bugs (i.e. the ones found by the core plugin and the additional fb-contrib plugin) I get an ugly error and an empty report when I want to generate the site. {code} [INFO] ****** FindBugsMojo executeReport ******* [INFO] XML outputFile is /home/traber/work/mycompany/fw/com.mycompany.fw.client/target/findbugsXml.xml [INFO] XML output Directory is /home/traber/work/mycompany/fw/com.mycompany.fw.client/target [INFO] ****** FindBugsMojo executeFindbugs ******* [INFO] Temp File is /home/traber/work/mycompany/fw/com.mycompany.fw.client/target/findbugsTemp.xml [INFO] Fork Value is true [java] The following errors occurred during analysis: [java] Field Summary not set [java] java.lang.IllegalStateException [java] At edu.umd.cs.findbugs.ba.AnalysisContext.getFieldSummary(AnalysisContext.java:202) [java] At edu.umd.cs.findbugs.OpcodeStack.sawOpcode(OpcodeStack.java:1252) [java] At edu.umd.cs.findbugs.OpcodeStack$JumpInfoFactory$1.sawOpcode(OpcodeStack.java:2130) [java] At edu.umd.cs.findbugs.visitclass.DismantleBytecode.visit(DismantleBytecode.java:758) [java] At edu.umd.cs.findbugs.visitclass.BetterVisitor.visitCode(BetterVisitor.java:217) [java] At edu.umd.cs.findbugs.visitclass.PreorderVisitor.visitCode(PreorderVisitor.java:166) [java] At org.apache.bcel.classfile.Code.accept(Code.java:141) [java] At edu.umd.cs.findbugs.visitclass.PreorderVisitor.doVisitMethod(PreorderVisitor.java:226) [java] At edu.umd.cs.findbugs.OpcodeStack$JumpInfoFactory.analyze(OpcodeStack.java:2137) [java] At edu.umd.cs.findbugs.OpcodeStack$JumpInfoFactory.analyze(OpcodeStack.java:2112) [java] At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.analyzeMethod(AnalysisCache.java:332) [java] At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getMethodAnalysis(AnalysisCache.java:282) [java] At edu.umd.cs.findbugs.OpcodeStack.resetForMethodEntry(OpcodeStack.java:2210) [java] At com.mebigfatguy.fbcontrib.detect.InefficientStringBuffering.visitCode(InefficientStringBuffering.java:70) [java] At org.apache.bcel.classfile.Code.accept(Code.java:141) [java] At edu.umd.cs.findbugs.visitclass.PreorderVisitor.doVisitMethod(PreorderVisitor.java:226) [java] At edu.umd.cs.findbugs.visitclass.PreorderVisitor.visitJavaClass(PreorderVisitor.java:271) [java] At org.apache.bcel.classfile.JavaClass.accept(JavaClass.java:276) [java] At edu.umd.cs.findbugs.BytecodeScanningDetector.visitClassContext(BytecodeScanningDetector.java:36) [java] At com.mebigfatguy.fbcontrib.detect.InefficientStringBuffering.visitClassContext(InefficientStringBuffering.java:57) [java] At edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:68) [java] At edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:979) [java] At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:230) [java] At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:348) [java] At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1057) [java] Warnings generated: 40 {code} > Findbugs plugins from the classpath do not work > ----------------------------------------------- > > Key: MFINDBUGS-142 > URL: http://jira.codehaus.org/browse/MFINDBUGS-142 > Project: Maven 2.x FindBugs Plugin > Issue Type: Bug > Affects Versions: 2.3.2 > Reporter: Thomas Traber > > If a Findbugs plugin on the classpath is specified using the pluginList > parameter of the Maven Findbugs plugin, then this plugin (it is a JAR file) > is copied into the target directory incorrectly and will not be processed by > findbugs. > Some analysis: > Plugins are made accessible to Findbugs by the FindBugsMojo as File by the > getResourceFile(String) method, which calls the ResourceManager method > getResourceAsFile(String, String). Everthing probably works fine if the > plugin is specified by a file name, but if the name is actually refering to a > classpath resource, then the DefaultResourceManager.getResourceAsFile(String, > String) method copies the resource with Readers and Writers which is of > course a bad idea for binary data. As a result the copied JAR file is not > readable by Findbugs and the plugin does not get processed. > I consider the possibility to specify the Findbugs plugins by a classpath > resource very important, since it is the best way to share the plugin in > several projects. The following snippets may help to see the principle idea: > {code:xml|title=pom.xml} > ... > <build> > <extensions> > <!-- This makes the Findbugs plugin fb-contrib-*.jar available to the > maven-findbugs-plugin on the classpath. --> > <extension> > <groupId>com.mycompany</groupId> > <artifactId>maven-java-tools</artifactId> > <version>1.0.0</version> > </extension> > </extensions> > .... > <plugin> > <groupId>org.codehaus.mojo</groupId> > <artifactId>findbugs-maven-plugin</artifactId> > <version>${findbugs-maven-plugin.version}</version> > <configuration> > <threshold>Low</threshold> > <effort>Max</effort> > > <pluginList>com/mycompany/java/tools/findbugs/fb-contrib-4.6.0.jar</pluginList> > </configuration> > </plugin>{code} > PS: It would be nice to have the possibilities of the pluginList entries a > bit better documented in the site documentation. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email