zoukankan      html  css  js  c++  java
  • 修复 Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:build-helper-maven-plugin:1.8:add-source (execution: add-source, phase: generate-sources)

    在maven项目中使用add-source时,pom.xml报如下错误:

    Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:build-helper-maven-plugin:1.8:add-source (execution: add-source, phase: generate-sources)

    加入的代码如下:

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>1.8</version>
                    <executions>
                        <execution>
                            <id>add-source</id>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>add-source</goal>
                            </goals>
                            <configuration>
                                <sources>
                                    <source>${basedir}/src/main/entity</source>
                                    <source>${basedir}/src/main/modules</source>
                                </sources>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

    原因是eclipse的m2e插件还没支持到execution,解决办法如下

    在pom.xml文件中,<plugins></plugins>后加入如下代码:

    <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>
                                        org.codehaus.mojo
                                    </groupId>
                                    <artifactId>
                                        build-helper-maven-plugin
                                    </artifactId>
                                    <versionRange>
                                        [1.8,)
                                    </versionRange>
                                    <goals>
                                        <goal>add-source</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore></ignore>
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>

    然后maven -> Update Project 即可

  • 相关阅读:
    SDOI 2009 HH的项链
    SDOI2012 longge的问题
    SDOI 2010 星际竞速
    SDOI2009 晨跑
    SDOI2008 仪仗队
    让我们来看一看C++ 三.表达式与运算符
    如何判断素数
    让我们来看一看C++ 一.对世界说你好
    币种校验的安全问题随笔
    Nodejs代码安全审计之YAPI
  • 原文地址:https://www.cnblogs.com/guyezhai/p/5629822.html
Copyright © 2011-2022 走看看