我正在尝试构建一个Web服务客户端。我正在使用maven 3.0.5来管理我的项目,我想使用wsimport目标来生成我的客户端存根。我已经阅读了如何配置pom以实现此here的示例。当我运行mvn clean install时,我的存根不会生成。下面是我的pom和运行mvn -X clean install输出的摘录。我正在尝试使用org.jvnet.jax-ws-commons版本的插件,因为org.codehaus.mojo版本已经过时了。有人能告诉我我做错了什么吗?谢谢。
这是我的pom:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.group.app</groupId>
<artifactId>ProjectName</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>ProjectName Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.2.8</version>
</dependency>
</dependencies>
<build>
<finalName>ProjectName</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<id>basic</id>
<phase>generate-sources</phase>
<goals>
<goal>wsimport</goal>
</goals>
</execution>
</executions>
<configuration>
<packageName>src/main/webapp/WEB-INF/classes/client_support</packageName>
<wsdlLocation>http://localhost:8080/wsdlLocation</wsdlLocation>
<destDir>src/main/webapp/WEB-INF/classes/</destDir>
<verbose>true</verbose>
<target>2.1</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
以下是运行mvn -X clean install的输出的一部分:
[INFO] ------------------------------------------------------------------------
[INFO] Building ProjectName Maven Webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[DEBUG] Resolving plugin version for org.jvnet.jax-ws-commons:jaxws-maven-plugin
[DEBUG] Could not find metadata org.jvnet.jax-ws-commons:jaxws-maven-plugin/maven-metadata.xml in local (/home/michael/.m2/repository)
[DEBUG] Skipped remote update check for org.jvnet.jax-ws-commons:jaxws-maven-plugin/maven-metadata.xml, locally cached metadata up-to-date.
[DEBUG] Resolved plugin version for org.jvnet.jax-ws-commons:jaxws-maven-plugin to 2.3.1-b03 from repository central (http://repo.maven.apache.org/maven2, releases)
以下是我尝试部署服务时tomcat日志文件的摘录。
Jun 18, 2014 11:47:28 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class com.sun.xml.ws.transport.http.servlet.WSServletContextListener
com.sun.xml.ws.transport.http.servlet.WSServletException: WSSERVLET11: failed to parse runtime descriptor: runtime modeler error:
Wrapper class path.to.jaxws.FaultBean is not found. Have you run APT to generate them? at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:118)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4701)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5204)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5199)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: com.sun.xml.ws.model.RuntimeModelerException: runtime modeler error:
Wrapper class path.to.jaxws.FaultBean is not found. Have you run APT to generate them?
at com.sun.xml.ws.model.RuntimeModeler.getClass(RuntimeModeler.java:287)
at com.sun.xml.ws.model.RuntimeModeler.processExceptions(RuntimeModeler.java:1006)
at com.sun.xml.ws.model.RuntimeModeler.processRpcMethod(RuntimeModeler.java:969)
at com.sun.xml.ws.model.RuntimeModeler.processMethod(RuntimeModeler.java:546)
at com.sun.xml.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:371)
at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:258)
at com.sun.xml.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:322)
at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:188)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:467)
at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(DeploymentDescriptor Parser.java:253)
at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.j ava:147)
at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServlet ContextListener.java:108)
... 7 more
运行mvn -X clean install后,项目构建成功,但是,既不创建支持存根,也不创建包含它的包。谢谢你的帮助。