Stumped on wsgen + maven configuration

流过昼夜 提交于 2019-12-12 13:33:12

问题


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


回答1:


  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
    

    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.

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

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




回答2:


You don't need to define the target, but first to compile the service impl class. mvn compile



来源:https://stackoverflow.com/questions/9017206/stumped-on-wsgen-maven-configuration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!