org.codehaus.mojo:缺少findbugs-maven-plugin

时间:2016-12-19 14:12:21

标签: maven pom.xml

我需要在新服务器上部署mvn项目,我想使用findbug插件 运行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.

这是我的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>

我很感激任何想法。

2 个答案:

答案 0 :(得分:1)

正如@Tunaki在评论中已经指出的那样。日志显式读为 [警告] ,接下来的消息非常清楚。

  

[警告]&#39; build.plugins.plugin.version&#39;对于   org.codehaus.mojo:缺少findbugs-maven-plugin。

此外,根据您的评论和现有的<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> ,您应修改构建,如下所示:

<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>

并报告

{{1}}

答案 1 :(得分:0)

我通过添加工件作为依赖项以及插件语句来解决这个问题。 maven分析的错误消失了。我不认为这有任何副作用。

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