难倒在wsgen + maven配置上

San*_*ndy 3 jax-ws maven-plugin wsgen

我花了一整天时间寻找一个解决方案来解决如何让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>
Run Code Online (Sandbox Code Playgroud)

此外,我尝试在命令行生成工件,没有更好的结果:

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
Run Code Online (Sandbox Code Playgroud)

PS:我在命令行使用"classes"文件夹作为端点类的位置.使用src文件夹只会返回命令行输入描述的错误.

对此有任何帮助真的很感激

谢谢

Bah*_*aha 6

  1. 使用命令行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
    
    Run Code Online (Sandbox Code Playgroud)

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

  2. 使用Maven

    使用org.jvnet.jax-ws-commons中的依赖项而不是org.codehaus.mojo.org.codehaus.mojo插件已迁移到org.jvnet.jax-ws-commons.
    请参阅来自http://jax-ws-commons.java.net/jaxws-maven-plugin/wsgen-mojo.html的 maven wsgen的不同有效选项. 如果项目基于默认的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>
    
    Run Code Online (Sandbox Code Playgroud)

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