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


Reply via email to