难倒了 wsgen + Maven配置
我花了一整天的时间寻找如何让 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:\workspace\ibabi\trunk\ibabi-ws\ibabi-ws-service\target\classes -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 文件夹只会返回命令行输入描述的错误。
对此有任何帮助将非常
感谢
I've spent a whole day searching for a solution on how to get wsgen + maven to generate artifacts from my annotated class with no avail, always ending with the "Could not find class file" error.
My pom.xml looks like the following :
<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>
Besides, I tried generating the artifacts at command line with no better results :
wsgen -cp C:\workspace\ibabi\trunk\ibabi-ws\ibabi-ws-service\target\classes -keep -s C:/workspace/ibabi/trunk/ibabi-ws/ibabi-ws-service/target/generated-sources/artifacts fr.extelia.ibabi.ws.convergence.impl.ServiceWSConvergence
PS : I'm using the "classes" folder as the location of the endpoint class at command line. Using the src folder just returns an error with the command line input description.
Any help on this would really appreciated
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用命令行 wsgen
运行 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.convergence.impl.ServiceWSConvergence 字节码文件应位于内部
C:\workspace\ibabi\trunk\ibabi-ws\ibabi-ws-service\target\classes。
使用 Maven
使用 org.jvnet.jax-ws-commons 的依赖项而不是 org.codehaus.mojo。 org.codehaus.mojo 插件已迁移到 org.jvnet.jax-ws-commons。
请参考 http://jax-ws-commons 中的 maven wsgen 的不同有效选项。 java.net/jaxws-maven-plugin/wsgen-mojo.html
如果项目基于默认的 Maven 项目结构,则以下示例片段将起作用。
<预置><代码><构建>
org.jvnet.jax-ws-commons ;
jaxws-maven-plugin ;
<插件管理>
<插件>
<插件>
<版本>2.1
<处决>
<执行>
<目标>
<目标>wsgen
<配置>
fr.extelia.ibabi.ws.convergence.impl.ServiceWSConvergence src/main/java
<依赖关系>
com.sun.xml.ws
jaxws-tools ;
<依赖关系>
<版本>2.2.5
如果您仍然遇到问题,请发布您的项目结构。
Using command line wsgen
When running wsgen command, first confirm source folder is C:/workspace/ibabi/trunk/ibabi-ws/ibabi-ws-service/target/generated-sources/artifacts and class files are generated inside
C:\workspace\ibabi\trunk\ibabi-ws\ibabi-ws-service\target\classes.
Before running wsgen, fr.extelia.ibabi.ws.convergence.impl.ServiceWSConvergence bytecode file should be inside
C:\workspace\ibabi\trunk\ibabi-ws\ibabi-ws-service\target\classes.
Using Maven
Use dependency from org.jvnet.jax-ws-commons instead of org.codehaus.mojo. org.codehaus.mojo plugin has been migrated to org.jvnet.jax-ws-commons.
Refer different valid options for maven wsgen from http://jax-ws-commons.java.net/jaxws-maven-plugin/wsgen-mojo.html
If project is based on default maven project structure, following sample snippet will work.
If you still get problem, please post your project structure.
您不需要定义目标,但首先要编译服务实现类。
MVN编译
You don't need to define the target, but first to compile the service impl class.
mvn compile