本文介绍了陷入wsgen + Maven配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我花了整整一天的时间寻找解决方案,以了解如何使wsgen + maven无法从我带注释的类中生成工件,但总是以找不到类文件"错误结尾.

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.

我的pom.xml如下所示:

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:我在命令行中使用"classes"文件夹作为端点类的位置.使用src文件夹只会在命令行输入说明中返回错误.

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

谢谢

推荐答案

  1. 使用命令行wsgen

  1. Using command line wsgen

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

运行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 .

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.

使用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项目结构,则以下示例代码段将起作用.

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.

<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>

如果仍然遇到问题,请发布您的项目结构.

If you still get problem, please post your project structure.

这篇关于陷入wsgen + Maven配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-19 04:22