2

I use the findbugs-maven-plugin to check for bugs with maven. My maven project is a multi-module project that roughly looks as follows:

java-module
    pom.xml
    src/ ...
pom.xml
scala-module
    pom.xml
    src/ ...

I use Jenkins to build and test the project, and Jenkins runs goal findbugs:findbugs in the top-most directory. Since FindBugs reports many spurious warnings for code that is generated by the Scala compiler, I would like to tell FindBugs not to analyze the code in scala-module. However, when I run findbugs:findbugs in the top-most directory, it always analyzes all classes in java-module and scala-module. How can I tell maven to ignore scala-module as a whole? I know about FindBugs exclude filters but I would to have a configuration option for FindBugs that tells it to simply not analyze the code in a certain submodule.

FindBugs is configured in pom.xml in subdirectory java-module as follows:

<reporting>
  <plugins>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>findbugs-maven-plugin</artifactId>
      <version>${version.plugin.codehaus.findbugs}</version>
      <configuration>
        <findbugsXmlOutput>true</findbugsXmlOutput>
        <findbugsXmlWithMessages>true</findbugsXmlWithMessages>
        <xmlOutput>true</xmlOutput>
      </configuration>
    </plugin>
  </plugins>
</reporting>

Despite the configuration being done only for the java-module, FindBugs will always also analyze scala-module.

2
  • Where is your findbugs configured? In the parent pom? Can you provide the configuration stanza?
    – noahlz
    Jun 17, 2013 at 14:55
  • @noahlz I have edited my post and added the configuration.
    – Valentin
    Jun 18, 2013 at 7:42

2 Answers 2

2

Add a configuration the scala-module pom.xml that explicitly instructs findbugs to skip the module, i.e.

<reporting>
  <plugins>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>findbugs-maven-plugin</artifactId>
      <configuration>
        <skip>true</skip>
      </configuration>
    </plugin>
  </plugins>
</reporting>

Note that Maven often requires you to repeat boilerplate XML for cases like this.

0
1

Noahlz's answer did not work for me, but adding the following snippet to the sub-module's POM.xml did the trick.

<properties>
    <findbugs.skip>true</findbugs.skip>
</properties>
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.