我正在尝试使用Spring Data和Neo4j。我开始尝试遵循这个由主站点链接的指南。特别地,我基于“Hello, World!”示例文件创建了pom.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)

我运行的是Eclipse 3.6.2和m2e 0.13。我不是Maven专家,所以如果可能的话,请在您的回答中说明清楚。

我也尝试了m2e 1.0.0通过这个更新网站,仍然得到相同的错误。


当前回答

作为前面答案的补充——如果您不能或不想将所有这些样板文件添加到您的项目POM中,我发现了一个变通方法。如果你看下面的位置:

{Eclipse_folder}/plugins/org.eclipse.m2e.lifecyclemapping.defaults_{m2e_version}

您应该可以找到一个名为lifecycle-mapping-metadata.xml的文件,您可以在其中进行与其他答案中描述的相同的更改,以及M2E插件执行中没有涉及到的更改。

其他回答

Eclipse m2e文档中的建议解决方案:

Use quick-fix on the error in pom.xml and select Permanently mark goal run in pom.xml as ignored in Eclipse build - this will generate the required boilerplate code for you. To instruct Eclipse to run your plugin during build - just replace the <ignore/> tag with <execute/> tag in the generated configuration: <action> <execute/> </action> Alternatively you can instruct Eclipse to run the plugin on incremental builds as well: <action> <execute> <runOnIncremental>true</runOnIncremental> </execute > </action>

多年来我一直遇到这个问题……eclipse的耻辱。如果你的应用程序被分割成maven模块,那么你可以考虑从IDE中删除受影响的模块,无论何时你需要重新生成/运行插件使用maven命令行安装,eclipse都很乐意在你的本地存储库中提供准备好的工件。不需要耍花招。

m2e 0.13引入了m2e连接器和m2e市场,扩展了m2e功能。 它就像旧的m2e-extras存储库。

您可以从首选项访问m2e市场:首选项>Maven>Discovery>Open Catalog。 安装WTP集成为我解决了大多数插件问题。

哪里可以找到WTP:

鼠标在pom.xml中的<插件>上,然后“发现新的m2e连接器”。

我安装了他们所有的默认检查和它的工作。

在我遇到类似问题的情况下,我没有使用Andrew的修复建议,而是在向pom.xml引入<pluginManagement>标记后就可以简单地工作了。看起来这个错误是由于缺少<pluginManagement>标记。因此,为了避免Eclipse中的异常,我们需要简单地将所有插件标记包含在<pluginManagement>标记中,如下所示:

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

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