生命周期配置未涵盖插件执行(JBossas 7 EAR 原型)
我正在使用 Eclipse 3.7 Indigo 和 Maven M2E 插件 1.0.100。
使用 JBoss 7.x JavaEE 6 EAR 原型,EAR 的 pom 给出以下错误:
生命周期配置未涵盖插件执行: org.apache.maven.plugins:maven-ear-plugin:2.6:生成-application-xml (执行:default-generate-application-xml,阶段: 生成资源)
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.6</version>
<configuration>
<!-- Tell Maven we are using Java EE 6 -->
<version>6</version>
<!-- Use Java EE ear libraries as needed. Java EE ear libraries
are in easy way to package any libraries needed in the ear, and automatically
have any modules (EJB-JARs and WARs) use them -->
<defaultLibBundleDir>lib</defaultLibBundleDir>
<modules></modules>
</configuration>
<plugin>
I am using Eclipse 3.7 Indigo with Maven M2E Plugin 1.0.100.
Using the JBoss 7.x JavaEE 6 EAR archetype, the pom for EAR is giving me this error:
Plugin execution not covered by lifecycle configuration:
org.apache.maven.plugins:maven-ear-plugin:2.6:generate-application-xml
(execution: default-generate-application-xml, phase:
generate-resources)
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.6</version>
<configuration>
<!-- Tell Maven we are using Java EE 6 -->
<version>6</version>
<!-- Use Java EE ear libraries as needed. Java EE ear libraries
are in easy way to package any libraries needed in the ear, and automatically
have any modules (EJB-JARs and WARs) use them -->
<defaultLibBundleDir>lib</defaultLibBundleDir>
<modules></modules>
</configuration>
<plugin>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
这是不久前推出的M2E插件的一个“功能”。它与 JBoss EAR 插件没有直接关系,但也发生在大多数其他 Maven 插件中。
如果您在
pom
中定义了插件执行(例如maven-ear-plugin:generate-application-xml
的执行),您还需要添加其他配置信息对于 M2E,它告诉 M2E 在 Eclipse 中运行构建时要做什么,例如,插件执行是否应该被 M2E 忽略或执行,是否也应该为增量构建执行,...如果该信息丢失,M2E 会抱怨它通过显示此错误 信息:请参阅此处以获取更详细的解释以及一些需要添加到 pom 中以消除该错误的示例配置:
https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html
This is a "feature" of the M2E plugin that had been introduced a while ago. It's not directly related to the JBoss EAR plugin but also happens with most other Maven plugins.
If you have a plugin execution defined in your
pom
(like the execution ofmaven-ear-plugin:generate-application-xml
), you also need to add additional config information for M2E that tells M2E what to do when the build is run in Eclipse, e.g. should the plugin execution be ignored or executed by M2E, should it be also done for incremental builds, ... If that information is missing, M2E complains about it by showing this error message:See here for a more detailed explanation and some sample config that needs to be added to the pom to make that error go away:
https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html
无论如何,已经太晚了,但我的解决方案很简单,右键单击 Eclipse 中的错误消息并选择“快速修复”>>忽略每个有此类错误的 pom
anyway it's too late but my solution was simple right-click on error-message in Eclipse and choosing Quick Fix >> Ignore for every pom with such errors
Eclipse 具有增量构建的概念。这非常有用,因为它可以节省大量时间。
这有什么用
假设您刚刚更改了一个 .java 文件。增量构建器将能够编译代码,而无需重新编译所有内容(这将花费更多时间)。
现在 Maven 插件有什么问题
大多数 Maven 插件都不是为增量构建而设计的,因此它给 m2e 带来了麻烦。 m2e 不知道插件目标是否至关重要或者是否无关紧要。如果它只是在单个文件更改时执行每个插件,那么将花费大量时间。
这就是 m2e 依赖元数据信息来确定应如何处理执行的原因。 m2e 提出了不同的选项来提供此元数据信息,优先顺序如下(从高到低)
是指在 pom 文件或任何文件的标记中指定 pluginManagement 部分是父母。 M2E 读取此配置来配置项目。下面的代码片段指示 m2e 忽略 yuicompressor-maven-plugin 的 jslint 和 compress 目标
3) 如果您不喜欢如果此元数据污染了您的 pom 文件,您可以将其存储在外部 XML 文件中(选项 3)。下面是一个示例映射文件,它指示 m2e 忽略 yuicompressor-maven-plugin 的 jslint 和 compress 目标
4) 如果您不喜欢这 3 个中的任何一个选项,您可以使用 maven 插件的 m2e 连接器(扩展)。连接器将反过来向 m2e 提供元数据。您可以在此查看连接器内的元数据信息的示例 链接 。您可能已经注意到元数据指的是配置器。这仅仅意味着 m2e 将责任委托给扩展作者提供的特定 java 类。配置器可以配置项目(例如添加其他源文件夹等)并决定是否在增量构建期间执行实际的 Maven 插件(如果如果在配置器中管理不当,可能会导致无休止的项目构建)
请参阅这些链接以获取配置示例(链接1,链接2)。因此,如果该插件可以通过外部连接器进行管理,那么您就可以安装它。 m2e 维护由其他开发人员贡献的此类连接器的列表。这称为发现目录。如果您还没有任何用于通过任何选项 (1-6) 执行的生命周期映射元数据,并且发现目录具有一些可以管理执行的扩展,则 m2e 将提示您安装连接器。
下图显示了 m2e 如何提示您安装 build-helper-maven-plugin 的连接器。
。
5)m2e 鼓励插件作者支持增量构建并在 maven-plugin 本身内提供生命周期映射。这意味着用户不必使用任何额外的生命周期映射或连接器。一些插件作者有 已经实现了这个
6) 默认情况下,m2e 保存大多数常用插件(如 maven-compiler-plugin 等)的生命周期映射元数据。
现在回到问题:您可能只需在 1、2 或 3 中为给您带来麻烦的特定目标提供忽略生命周期映射。
Eclipse has got the concept of incremental builds.This is incredibly useful as it saves a lot of time.
How is this Useful
Say you just changed a single .java file. The incremental builders will be able to compile the code without having to recompile everything(which will take more time).
Now what's the problem with Maven Plugins
Most of the maven plugins aren't designed for incremental builds and hence it creates trouble for m2e. m2e doesn't know if the plugin goal is something which is crucial or if it is irrelevant. If it just executes every plugin when a single file changes, it's gonna take lots of time.
This is the reason why m2e relies on metadata information to figure out how the execution should be handled. m2e has come up with different options to provide this metadata information and the order of preference is as below(highest to lowest)
1,2 refers to specifying pluginManagement section in the tag of your pom file or any of it's parents. M2E reads this configuration to configure the project.Below snippet instructs m2e to ignore the
jslint
andcompress
goals of the yuicompressor-maven-plugin3) In case you don't prefer polluting your pom file with this metadata, you can store this in an external XML file(option 3). Below is a sample mapping file which instructs m2e to ignore the
jslint
andcompress
goals of the yuicompressor-maven-plugin4) In case you don't like any of these 3 options, you can use an m2e connector(extension) for the maven plugin.The connector will in turn provide the metadata to m2e. You can see an example of the metadata information within a connector at this link . You might have noticed that the metadata refers to a configurator. This simply means that m2e will delegate the responsibility to that particular java class supplied by the extension author.The configurator can configure the project(like say add additional source folders etc) and decide whether to execute the actual maven plugin during an incremental build(if not properly managed within the configurator, it can lead to endless project builds)
Refer these links for an example of the configuratior(link1,link2). So in case the plugin is something which can be managed via an external connector then you can install it. m2e maintains a list of such connectors contributed by other developers.This is known as the discovery catalog. m2e will prompt you to install a connector if you don't already have any lifecycle mapping metadata for the execution through any of the options(1-6) and the discovery catalog has got some extension which can manage the execution.
The below image shows how m2e prompts you to install the connector for the build-helper-maven-plugin.
.
5)m2e encourages the plugin authors to support incremental build and supply lifecycle mapping within the maven-plugin itself.This would mean that users won't have to use any additional lifecycle mappings or connectors.Some plugin authors have already implemented this
6) By default m2e holds the lifecycle mapping metadata for most of the commonly used plugins like the maven-compiler-plugin and many others.
Now back to the question :You can probably just provide an ignore life cycle mapping in 1, 2 or 3 for that specific goal which is creating trouble for you.
一个很好的解决方法是提醒您可以更好地配置 m2e,而项目不会继承误报错误标记,只需将这些错误降级为警告:
Window ->;首选项-> Maven->错误/警告 ->生命周期配置未涵盖插件执行 = 警告
A good workaround to remind you that m2e could be better configured, without the project inheriting a false positive error marker, is to just downgrade those errors to warnings:
Window -> Preferences -> Maven -> Errors/Warnings -> Plugin execution not covered by lifecycle configuration = Warning
我尝试在清理后立即执行特定的插入,即清理后(默认为清理阶段)。这对我的 eclipse indigo 有用。只是添加后清洁解决了我的问题。
I tried to execute specific plugging right after clean up i.e. post-clean (default is clean phase). This worked for me with eclipse indigo. Just added post-clean resolved the problem for me.
通过应用以下解决方案,我能够在 Eclipse Kepler 4.3 中使用 maven-antrun-plugin 和 jaxb2-maven-plugin 解决相同的问题:
http://wiki.eclipse.org/M2E_plugin_execution_not_covered#Eclipse_4.2_add_default_mapping
所以我的 %elipse_workspace_name%/.metadata/.plugins/org.eclipse.m2e.core/lifecycle-mapping-metadata.xml 的内容如下:
*必须重新启动 Eclipse 才能看到错误消失。
I was able to resolve the same problem with maven-antrun-plugin and jaxb2-maven-plugin in Eclipse Kepler 4.3 by appying this solution:
http://wiki.eclipse.org/M2E_plugin_execution_not_covered#Eclipse_4.2_add_default_mapping
So the content of my %elipse_workspace_name%/.metadata/.plugins/org.eclipse.m2e.core/lifecycle-mapping-metadata.xml is as follows:
*Had to restart Eclipse to see the errors gone.
从 Maven Eclipse (m2e) 版本 0.12 开始,所有 Maven 生命周期目标必须映射到已安装的 m2e 扩展。在本例中,
maven-ear-plugin
有一个未映射的目标default-generate-application-xml
。您只需按照此处的说明即可排除未映射的生命周期目标:
https://wiki.eclipse.org/ M2E_plugin_execution_not_covered
或者,只需右键单击 Eclipse 中的错误消息并选择
快速修复
->忽略每个有此类错误的 pom
。忽略生命周期目标时应该小心:通常目标会做一些有用的事情,如果您将它们配置为在 Eclipse 中忽略,您可能会错过重要的构建步骤。您可能还需要考虑添加对 Maven Eclipse EAR 扩展的支持,以实现未映射的生命周期目标。
As of Maven Eclipse (m2e) version 0.12 all Maven life-cycle goals must map to an installed m2e extension. In this case, the
maven-ear-plugin
had an-unmapped goaldefault-generate-application-xml
.You can exclude un-mapped life-cycle goals by simply following the instructions here:
https://wiki.eclipse.org/M2E_plugin_execution_not_covered
Alternatively, simply right-click on the error message in Eclipse and choosing
Quick Fix
->Ignore for every pom with such errors
.You should be careful when ignoring life-cycle goals: typically goals do something useful and if you configure them to be ignored in Eclipse you may miss important build steps. You might also want to consider adding support to the Maven Eclipse EAR extension for the unmapped life-cycle goal.
通过 Jan 的回答中解释的机制,我已指示 m2e 插件忽略目标“generate-application-xml”。这消除了错误,并且似乎可以工作,因为 m2e 创建了 application.xml。
因此,基本上,当 Maven 构建在 m2e 插件的控制下在 Eclipse 中运行时,该错误迫使我们决定哪种机制负责生成 application.xml。我们决定由 m2e 负责。
With the mechanism explained in the answer of Jan I have instructed the m2e pluging to ignore the goal "generate-application-xml". This gets rid of the error and seems to work since m2e creates application.xml.
So basically the error forced us to decide which mechanism is in charge for generating application.xml when the Maven build runs inside Eclipse under the control of the m2e plugin. And we have decided that m2e is in charge.
您需要了解 M2E_plugin_execution_not_covered 中的内容,并按照以下步骤操作:
标签下显示为带有
的错误。例如:对于 write-project-properties 错误,请在生命周期映射元数据.xml 文件的
部分下添加此代码段:您将来应该不会看到任何项目的错误。
You need to understand the content in M2E_plugin_execution_not_covered and follow the steps mentioned below:
<ignore/>
under<action>
tags.eg: for write-project-properties error, add this snippet under the
<pluginExecutions>
section of the lifecycle-mapping-metadata.xml file:You should see no errors in the future for any project.
尽管这个问题太老了,但我想分享对我有用的解决方案,因为当涉及到这个错误时我已经检查了所有内容。这很痛苦,我花了两天时间尝试,最后解决方案是:
更新 eclipse 中的 M2e 插件
清理并再次构建
Even though the question is too old, but I would like to share the solution that worked for me because I already checked everything when it comes to this error. It was a pain, I spent two days trying and at the end the solution was:
update the M2e plugin in eclipse
clean and build again