我正在尝试使用在maven build中声明的wsimport
目标来使用web服务。但我正面临m2e connectors
的问题。我的POM中有错误说
Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:jaxws-maven-
plugin:1.10:wsimport (execution: default, phase: generate-sources)
我一直在尝试安装m2e连接器,但即使在市场上也没有。还有其他m2e连接器,但不是我需要的JAX-WS。
我已经关注并尝试了几乎所有提到here的解决方案,但都是徒劳的。
虽然生成资源没有问题。资源是在构建时成功生成的,但是这个POM错误不允许我的项目与我的tomcat同步,每次我必须手动部署战争来测试我做的一些小改动。 / p>
这一切真的很烦人,我需要找到解决方案。我在这里使用eclipse juno。 下面是我正在使用的POM文件
<build>
<finalName>home</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>1.10</version>
<executions>
<execution>
<phase>post-clean</phase>
<goals>
<goal>wsimport</goal>
</goals>
</execution>
</executions>
<!-- -->
<configuration>
<wsdlUrls>
<wsdlUrl>http://localhost:8080/email-service/services/EmailService?wsdl</wsdlUrl>
</wsdlUrls>
<sourceDestDir>${project.build.directory}/generated</sourceDestDir>
<verbose>true</verbose>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>additional-resources</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/home/WEB-INF/classes</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/src/main/webapp/resources/props</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
答案 0 :(得分:5)
有一个M2E jaxws-maven-connector GitHub项目:https://github.com/trajano/jaxws-maven-connector。它适用于Eclipse Kepler和org.codehaus.mojo:jaxws-maven-plugin:1.12
。
https://raw.github.com/trajano/jaxws-maven-connector/master/jaxws-connector-update-site/
(请参阅project)答案 1 :(得分:5)
投票给https://github.com/javaee/metro-jaxws-commons/issues/124并在插件中修复此问题。 然后你不需要连接器。
与此同时,你可以按照Archimedes Trajano的帖子
来破解这个答案 2 :(得分:1)
虽然我确实更新了jaxws-maven-connector以使用最新的M2E和jaxws-maven-plugin,但我发现了一种更好的方法(我也发布在http://www.trajano.net/2013/12/jaxws-maven-plugin-and-m2e/上)
您可以将以下配置文件添加到pom.xml文件中,以消除对不可发现的M2E插件的需求。
<profile>
<id>m2e</id>
<activation>
<property>
<name>m2e.version</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>attach-wsimport-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/target/generated-sources/wsimport</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.jvnet.jax-ws-commons
</groupId>
<artifactId>
jaxws-maven-plugin
</artifactId>
<versionRange>
[2.3.1-b03,)
</versionRange>
<goals>
<goal>wsimport</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
至于jaxws-maven-plugin配置,只要尽可能保持默认值:
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3.1-b03</version>
<configuration>
<wsdlUrls>
<wsdlUrl>http://www.webservicex.net/ConvertAcceleration.asmx?WSDL</wsdlUrl>
</wsdlUrls>
</configuration>
<executions>
<execution>
<id>wsimport</id>
<goals>
<goal>wsimport</goal>
</goals>
</execution>
</executions>
</plugin>