[ 
http://jira.codehaus.org/browse/MFINDBUGS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Thomas Traber updated MFINDBUGS-142:
------------------------------------

    Attachment: patch-against-findbugs-maven-plugin.txt

I added a patch against the current trunk version (2.3.3-SNAPSHOT) that fixes 
the problem. The JAR file of a findbugs plugin now gets copied with the use of 
streams instead of readers and writers. Therefore the JAR file will not get 
corrupted during the copy operation even on systems with an UTF-8 default 
encoding. Please feel free to use and improve the 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
>            Assignee: Garvin LeClaire
>         Attachments: fb-plugin-with-pluginList.zip, 
> patch-against-findbugs-maven-plugin.txt, pom.xml
>
>
> 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