有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

eclipse如何解决SpringDataMaven构建的“生命周期配置未涵盖的插件执行”

我正在努力与Spring Data and Neo4j合作。我一开始尝试跟随主站点链接到的this guide。特别是,我基于我的pom。从"Hello, World!" example file中删除xml。这是我的pom上的剪报。导致问题的插件的xml

<plugin>
<!-- Required to resolve aspectj-enhanced class features -->
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>aspectj-maven-plugin</artifactId>
    <version>1.0</version>
    <configuration>
        <outxml>true</outxml>
        <aspectLibraries>
            <aspectLibrary>
                <groupId>org.springframework</groupId>
                <artifactId>spring-aspects</artifactId>
            </aspectLibrary>
            <aspectLibrary>
                <groupId>org.springframework.data</groupId>
                <artifactId>spring-data-neo4j</artifactId>
            </aspectLibrary>
        </aspectLibraries>
        <source>1.6</source>
        <target>1.6</target>
    </configuration>
    <executions>
        <!-- ERROR HERE IN ECLIPSE SEE BELOW FOR FULL MESSAGE -->
        <execution>
            <goals>
                <goal>compile</goal>
                <goal>test-compile</goal>
            </goals>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>${aspectj.version}</version>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjtools</artifactId>
            <version>${aspectj.version}</version>
        </dependency>
    </dependencies>
</plugin>

我看到的错误是:

 Multiple annotations found at this line:
    - Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:aspectj-maven-plugin:1.0:compile (execution: default, phase: process-classes)
    - Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:aspectj-maven-plugin:1.0:test-compile (execution: default, phase: process-classes)

我正在运行Eclipse3.6.2和M2E0.13。我不是专家,所以如果可能的话,请在你的答案中解释清楚

我也尝试过m2e 1.0.0通过this update site,但仍然得到相同的错误


共 (6) 个答案

  1. # 1 楼答案

    m2e 0.13引入m2e连接器m2e市场,以扩展m2e功能。 这就像旧的m2e临时存储库

    您可以通过首选项访问m2e市场:首选项>;马文>;发现>;打开目录。 安装WTP集成为我解决了大多数插件问题

  2. # 2 楼答案

    真是一团糟。我不记得是在哪里找到的,但我必须添加以下内容才能让M2Eclipse开心。更可悲的是,要理解为什么需要这个标签并不容易

    <build>
          ... various 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>aspectj-maven-plugin</artifactId>
                                        <versionRange>[1.0,)</versionRange>
                                        <goals>
                                            <goal>test-compile</goal>
                                            <goal>compile</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <execute />
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    

    M2Eclipse插件还存在许多其他问题,这些问题根本无法处理Spring数据。最后,我禁用了M2Eclipse以支持Apache Eclipse plug-in

  3. # 3 楼答案

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

    To solve some long-standing issues, m2e 1.0 requires explicit instructions what to do with all Maven plugins bound to "interesting" phases of project build lifecycle. We call these instructions "project build lifecycle mapping" or simply "lifecycle mapping" because they define how m2e maps information from project pom.xml file to Eclipse workspace project configuration and behaviour during Eclipse workspace build.

    Project build lifecycle mapping configuration can be specified in project pom.xml, contributed by Eclipse plugins and there is also default configuration for some commonly used Maven plugins shipped with m2e. We call these "lifecycle mapping metadata sources". m2e will create error marker like below for all plugin executions that do not have lifecycle mapping in any of the mapping metadata sources.

    Plugin execution not covered by lifecycle configuration:
    org.apache.maven.plugins:maven-antrun-plugin:1.3:run
       (execution: generate-sources-input, phase: generate-sources)
    

    m2e matches plugin executions to actions using combination of plugin groupId, artifactId, version range and goal. There are three basic actions that m2e can be instructed to do with a plugin execution -- ignore, execute and delegate to a project configurator.

  4. # 4 楼答案

    在我遇到的类似问题中,我没有使用Andrew的建议进行修复,而是在我引入<;插件管理>标记到pom。有问题的xml。看起来该错误是由于缺少<;插件管理>;标签因此,为了避免Eclipse中的异常,只需将所有插件标记封装在<;插件管理>标记,如下所示:

    <build>
        <pluginManagement>
            <plugins>
                <plugin> ... </plugin>
                <plugin> ... </plugin>
                      ....
            </plugins>
        </pluginManagement>
    </build>
    

    一旦这个结构就位,错误就会消失

  5. # 5 楼答案

    来自Eclipse m2e documentation的建议解决方案:

    1. 对pom中的错误使用快速修复。xml并选择Permanently mark goal run in pom.xml as ignored in Eclipse build-这将为您生成所需的样板代码

    2. 要指示Eclipse在构建期间运行插件,只需在生成的配置中将<ignore/>标记替换为<execute/>标记即可:

      <action>
          <execute/>
      </action>
      

      或者,您也可以指示Eclipse在增量构建上运行插件:

      <action>
          <execute>
              <runOnIncremental>true</runOnIncremental>
          </execute >
      </action>
      
  6. # 6 楼答案

    在EclipseLuna4.4.0中,您可以选择在首选项中忽略此错误

    窗口首选项>Maven>错误/警告>生命周期配置未涵盖插件执行。根据需要选择忽略/警告/错误

    此外,在该错误的快速修复(Ctrl+1)中,它提供了一个选项 在Eclipse首选项中的Eclipse构建中将目标标记为忽略(实验性)

    这是一种更干净的方法,因为它不会修改pom.xml

    您需要执行一个Maven>更新项目以修复任何其他项目中的相同错误


    在STS(Spring工具套件)中,您可以选择在首选项中忽略此错误

    窗口>;偏好>;马文>;错误/警告>;生命周期配置未涵盖插件执行。根据需要选择忽略/警告/错误。 然后右键单击项目,单击Maven并更新项目,然后错误将消失