eclipse 如何解决 Spring Data Maven Builds 的“生命周期配置未涵盖的插件执行”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6352208/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to solve "Plugin execution not covered by lifecycle configuration" for Spring Data Maven Builds
提问by Andrew White
I am trying to work with Spring Data and Neo4j. I started by trying to follow this guidelinked to by the main site. In particular I based my pom.xml off of the "Hello, World!" example file. Here is a snip from my pom.xml for the plugin that is causing the issues...
我正在尝试使用Spring Data 和 Neo4j。我首先尝试遵循主站点链接的本指南。特别是我的 pom.xml 是基于“Hello, World!” 示例文件。这是我的 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>
The error I am seeing is:
我看到的错误是:
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)
I am running Eclipse 3.6.2 and m2e 0.13. I'm not a Maven expert, so please be very explanatory in your answers if possible.
我正在运行 Eclipse 3.6.2 和 m2e 0.13。我不是 Maven 专家,所以如果可能的话,请在你的答案中解释清楚。
I've also tried m2e 1.0.0via this update siteand still get the same error.
回答by Simeon Leyzerzon
In my case of a similar problem, instead of using Andrew's suggestion for the fix, it worked simply after I introduced <pluginManagement>tag to the pom.xml in question. Looks like that error is due to a missing <pluginManagement> tag. So, in order to avoid the exceptions in Eclipse, one needs to simply enclose all the plugin tags inside a <pluginManagement>tag, like so:
在我遇到类似问题的情况下,它没有使用 Andrew 的修复建议,而是在我将<pluginManagement>标记引入有问题的 pom.xml后简单地工作。看起来该错误是由于缺少 <pluginManagement> 标记造成的。因此,为了避免 Eclipse 中的异常,只需将所有插件标签包含在<pluginManagement>标签中,如下所示:
<build>
<pluginManagement>
<plugins>
<plugin> ... </plugin>
<plugin> ... </plugin>
....
</plugins>
</pluginManagement>
</build>
Once this structure is in place, the error goes away.
一旦这个结构就位,错误就会消失。
回答by Andrew White
What a mess. I don't remember where I found this but I had to add the following to get M2Eclipse to be happy. Even more sad is that it isn't exactly easy to understand why this tag is needed.
真是一团糟。我不记得我在哪里找到的,但我必须添加以下内容才能让 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>
There were a number of other issues with the M2Eclipse plug-in that simply didn't work with Spring Data. In the end I disabled M2Eclipse in favor of the Apache Eclipse plug-in.
M2Eclipse 插件还存在许多其他问题,它们根本无法与 Spring Data 一起使用。最后我禁用了 M2Eclipse 以支持Apache Eclipse 插件。
回答by ShaKa
In Eclipse Luna 4.4.0, you can chose to ignore this error in preferences
在 Eclipse Luna 4.4.0 中,您可以在首选项中选择忽略此错误
Window> Preferences> Maven> Errors/Warnings> Plugin execution not covered by lifecycle configuration. Select Ignore / Warning / Erroras you wish.
窗口>首选项> Maven>错误/警告>生命周期配置未涵盖的插件执行。根据需要选择忽略/警告/错误。
Also, in the quick fix (Ctrl + 1) for this error, it gives an option to mark goal as ignored in Eclipse build in Eclipse preferences (experimental)
此外,在针对此错误的快速修复 (Ctrl + 1) 中,它提供了一个选项,可在 Eclipse 首选项中的 Eclipse 构建中将目标标记为已忽略(实验性)
This is a cleaner way, as it doesn't modify your pom.xml
.
这是一种更简洁的方法,因为它不会修改您的pom.xml
.
You will need to do a Maven> Update projectto fix the same error in any other project as well.
您还需要执行Maven> Update 项目以修复任何其他项目中的相同错误。
In STS(Spring-tool-suite), you can choose to ignore this error in preferences
在STS(Spring-tool-suite)中,可以在preferences中选择忽略这个错误
Window > Preferences > Maven > Errors/Warnings > Plugin execution not covered by life-cycle configuration. Select Ignore / Warning / Error as your wish. Then. Right click the project click Maven and update the project then error will gone.
窗口 > 首选项 > Maven > 错误/警告 > 生命周期配置未涵盖的插件执行。根据需要选择忽略/警告/错误。然后。右键单击项目单击 Maven 并更新项目,然后错误将消失。
回答by Vedran
Suggested solution from Eclipse m2e documentation:
来自Eclipse m2e 文档的建议解决方案:
Use quick-fixon the error in pom.xmland 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>
对pom.xml 中的错误使用快速修复并选择- 这将为您生成所需的样板代码。
Permanently mark goal run in pom.xml as ignored in Eclipse build
要指示 Eclipse 在构建期间运行您的插件 - 只需将生成的配置中的
<ignore/>
标记替换为标记<execute/>
:<action> <execute/> </action>
或者,您也可以指示 Eclipse 在增量构建上运行插件:
<action> <execute> <runOnIncremental>true</runOnIncremental> </execute > </action>
回答by Thomas Broyer
See https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html.
请参阅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, executeand delegate to a project configurator.
为了解决一些长期存在的问题,m2e 1.0 需要明确说明如何处理绑定到项目构建生命周期“有趣”阶段的所有 Maven 插件。我们将这些指令称为“项目构建生命周期映射”或简称为“生命周期映射”,因为它们定义了 m2e 如何在 Eclipse 工作空间构建期间将信息从项目 pom.xml 文件映射到 Eclipse 工作空间项目配置和行为。
项目构建生命周期映射配置可以在项目 pom.xml 中指定,由 Eclipse 插件提供,也有一些 m2e 自带的常用 Maven 插件的默认配置。我们称这些为“生命周期映射元数据源”。m2e 将为在任何映射元数据源中没有生命周期映射的所有插件执行创建如下错误标记。
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 使用插件 groupId、artifactId、版本范围和目标的组合将插件执行与操作相匹配。可以指示 m2e 执行插件执行的三个基本操作 -忽略、执行和委托给项目配置器。
回答by ntheitroadbizarre
m2e 0.13 introduce a m2e connectorsand m2e Market Placeto extend m2e features. It's like the old m2e-extras repository.
m2e 0.13 引入了m2e 连接器和m2e Market Place以扩展 m2e 功能。它就像旧的 m2e-extras 存储库。
You can access the m2e market place from the preferences: Preferences>Maven>Discovery>Open Catalog. Installing WTP integrationsolved most plugin issues for me.
您可以从首选项访问 m2e 市场:Preferences>Maven>Discovery>Open Catalog。安装WTP 集成为我解决了大多数插件问题。
回答by kvm006
回答by David
Note that the M2Eclipse (m2e) version 1.7.0 available in today's Eclipse Neon release train supports new syntax for specifying lifecycle mapping metadata. As a result boilerplate like this (here we're telling m2e to ignore the goal):
请注意,今天 Eclipse Neon 发行版中提供的 M2Eclipse (m2e) 1.7.0 版支持用于指定生命周期映射元数据的新语法。结果是这样的样板(这里我们告诉 m2e 忽略目标):
<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>exec-maven-plugin</artifactId>
<versionRange>[1.5.0,)</versionRange>
<goals>
<goal>exec</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
can be replaced with a single line in the plugin's execution node:
可以用插件执行节点中的一行替换:
<?m2e ignore?>
See the release notesfor details.
有关详细信息,请参阅发行说明。
回答by htompkins
As an addendum to the previous answers -- there's a workaround I just discovered for if you can't or don't want to add all this boilerplate to your project POM. If you look in the following location:
作为之前答案的附录——如果您不能或不想将所有这些样板添加到您的项目 POM 中,我刚刚发现了一种解决方法。如果您查看以下位置:
{Eclipse_folder}/plugins/org.eclipse.m2e.lifecyclemapping.defaults_{m2e_version}
You should find a file called lifecycle-mapping-metadata.xml
where you can make the same changes described in the other answers and in M2E plugin execution not covered.
您应该找到一个名为的文件lifecycle-mapping-metadata.xml
,您可以在其中进行其他答案和未涵盖的 M2E 插件执行中描述的相同更改。
回答by Kristiaan
I had the same problem with Eclipse v3.7 (Indigo) and m2eclipse as my Maven plugin. The error was easily solved by explicitly stating the execution phase within the plugin definition. So my pom looks like this:
我在使用 Eclipse v3.7 (Indigo) 和 m2eclipse 时遇到了与我的 Maven 插件相同的问题。通过在插件定义中明确说明执行阶段,该错误很容易解决。所以我的 pom 看起来像这样:
<project>
...
<build>
...
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<timestampFormat>yyyy-MM-dd_HH-mm-ss</timestampFormat>
</configuration>
<executions>
<execution>
*<phase>post-clean</phase>*
<goals>
<goal>create-timestamp</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
...