难倒了 wsgen + Maven配置

发布于 2024-12-29 03:21:16 字数 1957 浏览 7 评论 0原文

我花了一整天的时间寻找如何让 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

清引 2025-01-05 03:21:16
  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-       
    来源/工件 
    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

  2. 使用 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.ServiceWSConvergencesrc/main/java

    <依赖关系>
    <依赖关系>
    com.sun.xml.ws
    jaxws-tools;
    <版本>2.2.5





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

  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.

心如狂蝶 2025-01-05 03:21:16

您不需要定义目标,但首先要编译服务实现类。
MVN编译

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文