Java 在父 pom 中使用 pluginManagement 的 Eclipse 中的生命周期配置错误未涵盖插件执行
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19432073/
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
Plugin execution not covered by lifecycle configuration error in eclipse with pluginManagement in parent pom
提问by would_like_to_be_anon
I have jaxws-maven-plugin in parent pom.xml in the pluginManagement tag and I am referring to this plugin in the child pom.
我在 pluginManagement 标签的父 pom.xml 中有 jaxws-maven-plugin,我指的是子 pom 中的这个插件。
mvn clean install is running fine. But, eclipse is complaining that "Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:jaxws-maven-plugin:1.12:wsimport (execution: FirstWsdl, phase: generate-sources)".
mvn clean install 运行良好。但是,eclipse 抱怨“生命周期配置未涵盖插件执行:org.codehaus.mojo:jaxws-maven-plugin:1.12:wsimport(执行:FirstWsdl,阶段:generate-sources)”。
Could you suggest how to avoid this error in eclipse?
你能建议如何在 Eclipse 中避免这个错误吗?
parent pom
父 pom
<pluginManagement>
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>1.12</version>
<executions>
<execution>
<id>FirstWsdl</id>
<goals>
<goal>wsimport</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<wsdlLocation>location/file.wsdl</wsdlLocation>
<wsdlFiles>
<wsdlFile>file.wsdl</wsdlFile>
</wsdlFiles>
<packageName>com.xxx.package</packageName>
</configuration>
</execution>
</executions>
<configuration>
<sourceDestDir>${basedir}/generated</sourceDestDir>
<verbose>true</verbose>
<extension>true</extension>
<keep>true</keep>
<vmArgs>
<vmArg .../>
</vmArgs>
</configuration>
</plugin>
...
</plugins>
</pluginManagement>
child pom
孩子绒球
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
</plugin>
</plugins>
I looked at this question and reply How to solve "Plugin execution not covered by lifecycle configuration" for Spring Data Maven Builds, but, should I use pluginManagement both in parent and child pom to avoid this error?
我查看了这个问题并回答了如何解决 Spring Data Maven Builds 的“生命周期配置未涵盖的插件执行”,但是,我应该在父和子 pom 中使用 pluginManagement 来避免此错误吗?
采纳答案by VonC
This should be:
这应该是:
documented in the wiki page "M2E plugin execution not covered":
Project build lifecycle mapping can be configured in a project's
pom.xml
, contributed by Eclipse plugins, or defaulted to the 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.illustrated in "How to solve “Plugin execution not covered by lifecycle configuration” for Spring Data Maven Builds" (that you reference).
- either by adding the lifecycleMappingMetadata in the parent pom.
- or by enclosing the plugins with the
<pluginManagement>
tag (in both pom).
在维基页面“ M2E 插件执行未涵盖”中记录:
项目构建生命周期映射可以在项目的 中配置
pom.xml
,由 Eclipse 插件提供,或者默认为 m2e 附带的常用 Maven 插件。
我们称这些为“生命周期映射元数据源”。
m2e 将为在任何映射元数据源中没有生命周期映射的所有插件执行创建如下错误标记。在“如何解决 Spring Data Maven Builds 的“生命周期配置未涵盖的插件执行”中说明(您参考)。
- 通过在父 pom.xml 中添加生命周期映射元数据。
- 或者通过用
<pluginManagement>
标签(在两个 pom 中)封闭插件。
That threadadds more details to your specific error message:
该线程为您的特定错误消息添加了更多详细信息:
when taking a look in the Eclipse-UI in the project properties under “Maven” -> “Lifecyle Mapping” (having checked the “Show lifecycle phases” checkbox and disabled “Show ignored executions”), I see the following content.
To my understanding this file shows the mapping between the Eclipse build lifecycle (runtime/incremental) and its bound Maven plugins.
Currently, it does not contain the “jax-ws
” plugin respectively its goal “wsimport
”.The problem is that you have the
jax-ws
plugin declared in thepluginManagement
section.
To get a binding to a phase it should be in build/plugins.
Performing a Maven build from CLI wouldn't work either, so I suspect that you're not doing the standard "mvn install"?To get the Maven execution from within Eclispe to work you don't have to do anything.
But if you want to have incremental/runtime support in the IDE you should get the proper m2e connector. If you look at the pom in the POM editor in Eclipse, the plugin execution should be marked with a red error X. Hover on that and you should get an option to find one ("Discover new m2e connectors").
在“Maven”->“生命周期映射”下的项目属性中查看 Eclipse-UI 时(已选中“显示生命周期阶段”复选框并禁用“显示忽略的执行”),我看到以下内容。
据我了解,这个文件显示了 Eclipse 构建生命周期(运行时/增量)与其绑定的 Maven 插件之间的映射。
目前,它不包含“jax-ws
”插件及其目标“wsimport
”。问题是您
jax-ws
在该pluginManagement
部分中声明了插件。
要绑定到一个阶段,它应该在构建/插件中。
从 CLI 执行 Maven 构建也不起作用,所以我怀疑您没有执行标准的“mvn install”?要从 Eclispe 内部执行 Maven,您无需执行任何操作。
但是如果您想在 IDE 中获得增量/运行时支持,您应该获得合适的 m2e 连接器。如果您在 Eclipse 的 POM 编辑器中查看 pom,插件执行应标有红色错误 X。将鼠标悬停在其上,您应该可以找到一个选项(“发现新的 m2e 连接器”)。
回答by Robert Scholte
https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.htmlis the original page which explains it all. Defining it in the parent should be enough for its children.
https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html是解释这一切的原始页面。对于它的孩子来说,在父级中定义它应该足够了。
回答by Dawid D
If you can't find connectior you can turn off this error in eclipse because as a documentation says:
如果找不到连接器,则可以在 Eclipse 中关闭此错误,因为正如文档所说:
To get the Maven execution from within Eclispe to work you don't have to do anything.
要从 Eclispe 内部执行 Maven,您无需执行任何操作。
so go to Eclipse: Preferences -> Maven -> Error/Warnings
and change Error to Warning in option: Plugin execution not converted by lifecycle configuration
所以转到 Eclipse:Preferences -> Maven -> Error/Warnings
并将错误更改为警告选项:Plugin execution not converted by lifecycle configuration
回答by dansek
Go to pom.xml and right click > Add Dependency> enter the Group Id and Artifact Id click ok. This will resolve the "Plugin execution not covered by lifecycle" issue.
转到 pom.xml 并右键单击 > 添加依赖项 > 输入组 ID 和工件 ID 单击确定。这将解决“生命周期未涵盖的插件执行”问题。