stamnik
stamnik

Reputation: 23

org.codehaus.mojo:findbugs-maven-plugin is missing

I need deploy mvn project on new server and I wanna use findbug plugin I get the below error when I run mvn install:

 myServer:~/myrepository$ mvn install
    [INFO] Scanning for projects...
    [WARNING]
    [WARNING] Some problems were encountered while building the effective model for com.example:simple-app:war:0.0.1-SNAPSHOT
    [WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:findbugs-maven-plugin is missing. @ line 56, column 12
    [WARNING]
    [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
    [WARNING]
    [WARNING] For this reason, future Maven versions might no longer support building such malformed projects.

Here is my pom.xml

        <build>
            <plugins>
                    <plugin>
                            <groupId>org.springframework.boot</groupId>
                            <artifactId>spring-boot-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                            <groupId>org.codehaus.mojo</groupId>
                            <artifactId>findbugs-maven-plugin</artifactId>
                    </plugin>
            </plugins>
    </build>

    <reporting>
            <plugins>
                    <plugin>
                            <groupId>org.codehaus.mojo</groupId>
                            <artifactId>findbugs-maven-plugin</artifactId>
                            <version>3.0.5-SNAPSHOT</version>
                            <configuration>
                                    <xmlOutput>true</xmlOutput>
                                    <!-- Optional directory to put findbugs xdoc xml report -->
                                    <xmlOutputDirectory>target/site</xmlOutputDirectory>
                            </configuration>
                    </plugin>
            </plugins>
    </reporting>

I would appreciate any ideas.

Upvotes: 1

Views: 12723

Answers (2)

Sindre
Sindre

Reputation: 300

I solved this by adding the artifact as a dependency in addition to the plugin statement. The error from maven analysis disappeared. I do not think this has any side effects.

    <dependency>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
        <version>n.n.n</version>
    </dependency>

Upvotes: 0

Naman
Naman

Reputation: 31878

As already pointed out by @Tunaki in comments. The logs explicitly read [WARNING] and the message next is very clear.

[WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:findbugs-maven-plugin is missing.


Also, going by your comment and the existing pom.xml, you shall modify the build as follows:

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>1.4.2.RELEASE</version> <!-- using latest from maven central, feel free to use any specific -->
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>findbugs-maven-plugin</artifactId>
            <version>3.0.4</version> <!-- using latest from maven central, feel free to use any specific -->
        </plugin>
     </plugins>
</build>

and reporting as well to

<reporting>
    <plugins>
         <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>findbugs-maven-plugin</artifactId>
              <version>3.0.4</version> <!--have modified this -->
              <configuration>
                  <xmlOutput>true</xmlOutput>
                  <!-- Optional directory to put findbugs xdoc xml report -->
                  <xmlOutputDirectory>target/site</xmlOutputDirectory>
              </configuration>
         </plugin>
    </plugins>
</reporting>

Upvotes: 3

Related Questions