发布wsdl java M2E插件执行未涵盖

时间:2012-01-05 15:40:50

标签: maven-2 wsdl wsdl2java

我编写了一个WSDL,我想生成java类。

我将cxf-codegen-plugin用于maven2,但我在Eclipse中遇到以下验证错误:

  

生命周期配置未涵盖插件执行:   org.apache.cxf:cxf-codegen-plugin:2.2.7:wsdl2java(执行:   generate-sources,phase:generate-sources)。

有人可以帮我解决这个问题吗?或者提出另一种解决方案?

3 个答案:

答案 0 :(得分:5)

错误消息听起来像来自maven eclipse集成(m2e)。如果构建是从命令行运行而不是从eclipse中运行那么可能这个article on the eclipse wiki可以帮助你配置eclipse。

This answer显示了另一个maven插件的类似问题的解决方案。

答案 1 :(得分:4)

您可以将此代码段添加到您的pom.xml中(来自@JörnHorstmann发布的链接):

<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.apache.cxf</groupId>
                                        <artifactId>cxf-codegen-plugin</artifactId>
                                        <versionRange>[2.3.3,)</versionRange>
                                        <goals>
                                            <goal>wsdl2java</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <execute />
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

更重要的一行是:

<groupId>org.apache.cxf</groupId>
                                        <artifactId>cxf-codegen-plugin</artifactId>
                                        <versionRange>[2.3.3,)</versionRange>
                                        <goals>
                                            <goal>wsdl2java</goal>
                                        </goals>

因此,您必须确保使用的是哪个版本的CXF ... 希望这可以帮助...

答案 2 :(得分:0)

将插件版本更改为此特定版本。之后,运行Maven更新项目,最后运行Maven generate-sources

<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>2.7.10</version>

致以最诚挚的问候,