Using custom detectors with FindBugs Maven plugin

Posted by Lóránt Pintér on Stack Overflow See other posts from Stack Overflow or by Lóránt Pintér
Published on 2010-08-09T10:02:01Z Indexed on 2011/01/03 17:53 UTC
Read the original article Hit count: 192

Filed under:
|
|

I have a nice JAR of some custom FindBugs detectors I'd like to use with the FindBugs Maven plugin. There is a way to do this with the plugin via the <pluginList> configuration parameter, but that only accepts local files, URLs, or resources.

The only way I found for doing so is to somehow copy my JAR to a local file (maybe via the Dependency plugin) and then configure the FindBugs plugin something like this:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>findbugs-maven-plugin</artifactId>
    <version>2.3.1</version>
    <configuration>
        <pluginList>${project.build.directory}/my-detectors.jar</pluginList>
    </configuration>
</plugin>

But this is not very flexible. Is there a way to use Maven's dependency management features together with FindBugs' plugins? I'd like to use something like this:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>findbugs-maven-plugin</artifactId>
    <dependencies>
        <dependency>
            <groupId>com.lptr.findbugs</groupId>
            <artifactId>my-detectors</artifactId>
            <version>1.0</version>
        </dependency>
    </dependencies>
</plugin>

...but this simply overrides the core FindBugs detectors.

© Stack Overflow or respective owner

Related posts about java

Related posts about maven-2