我花了一整天的时间寻找如何让wsgen+maven从我的注释类中生成工件的解决方案,但没有成功,总是以"找不到类文件"错误结束。
我的pom.xml如下所示:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>wsgen</goal>
</goals>
</execution>
</executions>
<configuration>
<sei>fr.extelia.ibabi.ws.convergence.impl.ServiceWSConvergence</sei>
<keep>true</keep>
<verbose>true</verbose>
<sourceDestDir>target/generated-sources/artifacts</sourceDestDir>
<packageName>fr.extelia.ibabi.ws.convergence.stub</packageName>
</configuration>
<dependencies>
<dependency>
<groupId>javax.jws</groupId>
<artifactId>jsr181-api</artifactId>
<version>1.0-MR1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.2.5</version>
</dependency>
</dependencies>
</plugin>
此外,我尝试在命令行生成工件,但没有更好的结果:
wsgen -cp C:workspaceibabitrunkibabi-wsibabi-ws-servicetargetclasses -keep -s C:/workspace/ibabi/trunk/ibabi-ws/ibabi-ws-service/target/generated-sources/artifacts fr.extelia.ibabi.ws.convergence.impl.ServiceWSConvergence
PS:我在命令行中使用"classes"文件夹作为端点类的位置。使用src文件夹只会返回一个带有命令行输入描述的错误。
任何关于这方面的帮助都将非常感谢
感谢
-
使用命令行wsgen
wsgen -cp C:workspaceibabitrunkibabi-wsibabi-ws-servicetargetclasses -keep -s C:/workspace/ibabi/trunk/ibabi-ws/ibabi-ws-service/target/generated- sources/artifacts fr.extelia.ibabi.ws.convergence.impl.ServiceWSConvergence
运行wsgen命令时,首先确认源文件夹为C:\workspace/ibabi/trunk/ibabi-ws/ibabi-ws-service/target/generated-sources/artifacts,并且类文件在内部生成C: \workspace\ibabi\trunk\ibabi ws\ibabi ws service\target\classes。在运行wsgen之前,fr.extelia.ibabi.ws.envergency.impl.ServiceWSConvergence字节码文件应该在内部C: \workspace\ibabi\trunk\ibabi ws\ibabi ws service\target\classes。
-
使用Maven
使用org.jvnet.jax-ws-commons的依赖项,而不是org.codehaus.mojo。org.codeaus.mojo插件已迁移到org.jvnet.jax-ws-commons。
从中引用maven wsgen的不同有效选项http://jax-ws-commons.java.net/jaxws-maven-plugin/wsgen-mojo.html若这个项目是基于默认的maven项目结构,那个么下面的示例片段将起作用。<build> <pluginManagement> <plugins> <plugin> <groupId>org.jvnet.jax-ws-commons</groupId> <artifactId>jaxws-maven-plugin</artifactId> <version>2.1</version> <executions> <execution> <goals> <goal>wsgen</goal> </goals> </execution> </executions> <configuration> <sei>fr.extelia.ibabi.ws.convergence.impl.ServiceWSConvergence</sei> <sourceDestDir>src/main/java</sourceDestDir> </configuration> <dependencies> <dependency> <groupId>com.sun.xml.ws</groupId> <artifactId>jaxws-tools</artifactId> <version>2.2.5</version> </dependency> </dependencies> </plugin> </plugins> </pluginManagement> </build>
如果你仍然有问题,请张贴你的项目结构。
您不需要定义目标,而是首先编译服务impl类。mvn编译