使用父pom中的pluginManagement在eclipse中生命周期配置错误未涵盖插件执行

时间:2023-01-26 09:58:40

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,阶段:生成源)”。

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

孩子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来避免此错误吗?

3 个解决方案

#1


19  

This should be:

这应该是:

  • documented in the wiki page "M2E plugin execution not covered":

    维基页面中记录的“未涵盖的M2E插件执行”:

    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.

    项目构建生命周期映射可以在项目的pom.xml中配置,由Eclipse插件提供,或者默认为m2e附带的常用Maven插件。我们将这些称为“生命周期映射元数据源”。 m2e将为所有在任何映射元数据源中都没有生命周期映射的插件执行创建如下所示的错误标记。

  • illustrated in "How to solve “Plugin execution not covered by lifecycle configuration” for Spring Data Maven Builds" (that you reference).

    “如何解决”插件执行中未说明的“生成周期配置”(适用于Spring Data Maven Builds)(您参考)。

    • either by adding the lifecycleMappingMetadata in the parent pom.
    • 或者通过在父pom中添加lifecycleMappingMetadata。
    • or by enclosing the plugins with the <pluginManagement> tag (in both pom).
    • 或者用 标签封闭插件(在两个pom中)。

That thread adds 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”.

当在“Maven” - >“Lifecyle Mapping”下查看项目属性中的Eclipse-UI时(检查“显示生命周期阶段”复选框并禁用“显示忽略的执行”),我看到以下内容。据我所知,这个文件显示了Eclipse构建生命周期(运行时/增量)与其绑定的Maven插件之间的映射。目前,它不包含“jax-ws”插件,其目标分别为“wsimport”。

The problem is that you have the jax-ws plugin declared in the pluginManagement 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"?

问题是你在pluginManagement部分声明了jax-ws插件。要获得绑定到阶段,它应该在build / plugins中。从CLI执行Maven构建也不起作用,所以我怀疑你没有做标准的“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").

要从Eclispe内部执行Maven执行工作,您无需执行任何操作。但是如果你想在IDE中获得增量/运行时支持,你应该得到合适的m2e连接器。如果你在Eclipse中的POM编辑器中查看pom,插件执行应该用红色错误X标记。将鼠标悬停在那上面你应该找到一个选项(“发现新的m2e连接器”)。

#2


15  

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并在选项中将Error更改为Warning:插件执行未被生命周期配置转换

#3


0  

https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html is 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是解释所有内容的原始页面。在父母中定义它应该足够其子女。

#1


19  

This should be:

这应该是:

  • documented in the wiki page "M2E plugin execution not covered":

    维基页面中记录的“未涵盖的M2E插件执行”:

    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.

    项目构建生命周期映射可以在项目的pom.xml中配置,由Eclipse插件提供,或者默认为m2e附带的常用Maven插件。我们将这些称为“生命周期映射元数据源”。 m2e将为所有在任何映射元数据源中都没有生命周期映射的插件执行创建如下所示的错误标记。

  • illustrated in "How to solve “Plugin execution not covered by lifecycle configuration” for Spring Data Maven Builds" (that you reference).

    “如何解决”插件执行中未说明的“生成周期配置”(适用于Spring Data Maven Builds)(您参考)。

    • either by adding the lifecycleMappingMetadata in the parent pom.
    • 或者通过在父pom中添加lifecycleMappingMetadata。
    • or by enclosing the plugins with the <pluginManagement> tag (in both pom).
    • 或者用 标签封闭插件(在两个pom中)。

That thread adds 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”.

当在“Maven” - >“Lifecyle Mapping”下查看项目属性中的Eclipse-UI时(检查“显示生命周期阶段”复选框并禁用“显示忽略的执行”),我看到以下内容。据我所知,这个文件显示了Eclipse构建生命周期(运行时/增量)与其绑定的Maven插件之间的映射。目前,它不包含“jax-ws”插件,其目标分别为“wsimport”。

The problem is that you have the jax-ws plugin declared in the pluginManagement 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"?

问题是你在pluginManagement部分声明了jax-ws插件。要获得绑定到阶段,它应该在build / plugins中。从CLI执行Maven构建也不起作用,所以我怀疑你没有做标准的“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").

要从Eclispe内部执行Maven执行工作,您无需执行任何操作。但是如果你想在IDE中获得增量/运行时支持,你应该得到合适的m2e连接器。如果你在Eclipse中的POM编辑器中查看pom,插件执行应该用红色错误X标记。将鼠标悬停在那上面你应该找到一个选项(“发现新的m2e连接器”)。

#2


15  

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并在选项中将Error更改为Warning:插件执行未被生命周期配置转换

#3


0  

https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html is 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是解释所有内容的原始页面。在父母中定义它应该足够其子女。