MAVEN “Plugin execution not covered by lifecycle configuration”

时间:2023-01-25 15:10:59

pom文件中报错提示:

Plugin execution not covered by lifecycle configuration: net.alchim31.maven:yuicompressor-maven-plugin:1.5.1:compress (execution: default, phase: process-
resources)

  上网一搜,很多人说在<plugins>标签外面加<pluginManagement>标签就可以了,加了pluginManagement标签之后果真没报错了,本地也可以打包成功。但是随后在jenkins上自动构建时失败,无法打包。

  继续在*查询发现

      http://*.com/questions/6008942/yuicompressor-plugin-execution-not-covered-in-m2e

  https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html

  http://*.com/questions/27407414/plugin-execution-not-covered-by-lifecycle-configuration

  改为在pom文件后面加如下配置:

<pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>
                                            net.alchim31.maven
                                        </groupId>
                                        <artifactId>
                                            yuicompressor-maven-plugin
                                        </artifactId>
                                        <versionRange>
                                            [1.5.1,)
                                        </versionRange>
                                        <goals>
                                            <goal>compress</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>