maven插件异常:Plugin execution not covered by lifecycle configuration

来源:互联网 发布:a.i.channel软件 编辑:程序博客网 时间:2024/06/04 08:22

maven插件异常:Plugin execution not covered by lifecycle configuration


在导入maven工程的时候,经常遇到Plugin execution not covered by lifecycle configuration 异常。为了处理这种异常,在网上搜寻结果,发现并不能解决我的问题,所以这里描述下自己的解决方案。

问题描述

在导入java设计模式工程的时候,顶层pom文件提示Plugin execution not covered by lifecycle configuration异常(图中已经解决此异常,所以看不到。)。
Alt text
执行了maven的各种操作,都无法去除此异常,所以上网查询了一下。

网络解决方案

  1. 加management
    pluginManagement表示这里只是定义,而没有真正的使用。所以可以解决出错。但是如pluginmanagement的功能,我们无法再使用此插件。
  2. 修改eclipse配置
    Window-Perferences-Maven-Lifecycle Mapping 中添加ignore,忽略此错误。
  3. quick fix 忽略此问题

问题的原因

此插件需要eclipse安装插件支持。
所以在eclipse中安装此插件就可以解决error了。
在eclipse的Markers中选择出错条目,右键后点击quick fix。按照引导安装插件即可。

maven-checkstyle-plugin

因此本次问题的原因是,项目中引用了maven-checkstyle-plugin。所以解决问题的验证也是通过此插件。
引用此插件的pom配置

    <build>        <plugins>            <plugin>                <groupId>org.springframework.boot</groupId>                <artifactId>spring-boot-maven-plugin</artifactId>            </plugin>            <plugin>                <groupId>org.apache.maven.plugins</groupId>                <artifactId>maven-checkstyle-plugin</artifactId>                <version>2.17</version>                <configuration>                    <configLocation>${basedir}/checkstyle-checker.xml</configLocation>                </configuration>                <executions>                    <execution>                        <id>validate</id>                        <goals>                            <goal>check</goal>                        </goals>                        <phase>validate</phase>                        <configuration>                            <configLocation>checkstyle.xml</configLocation>                            <suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>                            <encoding>UTF-8</encoding>                            <consoleOutput>true</consoleOutput>                            <failsOnError>true</failsOnError>                            <includeTestSourceDirectory>true</includeTestSourceDirectory>                        </configuration>                    </execution>                </executions>            </plugin>        </plugins>    </build> ```   ```xml        <reporting>        <plugins>            <plugin>                <groupId>org.apache.maven.plugins</groupId>                <artifactId>maven-checkstyle-plugin</artifactId>                <version>2.17</version>            </plugin>        </plugins>    </reporting>
阅读全文
0 0