【问题标题】:maven jaxws Failed to execute wsgenmaven jaxws 执行 wsgen 失败
【发布时间】:2012-01-06 19:50:13
【问题描述】:

我正在使用带有 maven 3 的 netbeans。当我尝试使用 jaxws-maven-plugin 进行编译时,出现以下错误。

这是我的pom

 <build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxws-maven-plugin</artifactId>
            <executions>
                <execution>
                    <id>teamWS</id>
                    <goals>
                        <goal>wsgen</goal>
                    </goals>
                    <phase>generate-sources</phase>
                    <configuration>
                        <resourceDestDir>${project.build.directory}/classes/wsdl</resourceDestDir>
                        <sei>xyz.timerserver.server.TimeServer</sei>
                        <genWsdl>true</genWsdl>
                        <keep>true</keep>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
    </dependency>

    <dependency>
        <groupId>javax.annotation</groupId>
        <artifactId>jsr250-api</artifactId>
    </dependency>

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

</dependencies>

这是我收到的错误消息。我尝试使用系统范围依赖添加 tools.jar,但仍然没有运气

Failed to execute goal org.codehaus.mojo:jaxws-maven-plugin:1.10:wsgen (teamWS) on project JWSServer: Failed to execute wsgen: com/sun/mirror/apt/AnnotationProcessorFactory: com.sun.mirror.apt.AnnotationProcessorFactory -> [Help 1]

【问题讨论】:

    标签: maven jax-ws


    【解决方案1】:

    作为第一步,确保您使用正确的 java 版本运行 maven -- jaxws:wsgen (1.12) 似乎与 java 7 出现故障,在这种情况使用java 6,即:

    • 如果你从 shell 运行它,export JAVA_HOME=/path/to/java/6
    • 如果您从 IDE 运行它,请在 IDE 启动时指定 java 版本
      • 例如对于eclipse,使用启动选项-vm /path/to/java/6

    对我来说,这解决了由com.sun.xml.bind.v2.runtime.IllegalAnnotationsException引起的Failed to execute wsgen

    【讨论】:

    • 从 Java 8 切换到 Java 7 为我解决了这个问题。
    【解决方案2】:

    尝试使用来自 JAX-WS commons 项目的插件的更新版本。

    <groupId>org.jvnet.jax-ws-commons</groupId>
    <artifactId>jaxws-maven-plugin</artifactId>
    <version>2.2</version>
    

    【讨论】:

      【解决方案3】:

      项目刚刚回到 MojoHaus,所以您应该使用来自there 的最新版本。

      1. 1.0-1.12 (groupId org.codehaus.mojo)
      2. 2007-2015:2.1-2.3.1(groupId org.jvnet.jax-ws-commons
      3. 2015 年至今:>=2.4 (groupId org.codehaus.mojo)

      原始代码是在 Codehaus Mojo 项目中开发的,然后截至 2007 年 3 月,该项目移至 jax-ws-commons,版本 1.x 在 org.codehaus.mojo groupId 中,版本 2.x 在 org.jvnet .jax-ws-commons groupId。 2015 年 9 月,对于 2.4 版,它回到了 org.codehaus.mojo groupId 中的 MojoHaus(Codehaus Mojo 的新家)

      <dependency>
       <groupId>org.codehaus.mojo</groupId>
       <artifactId>jaxws-maven-plugin</artifactId>
       <version>2.5</version>
      </dependency>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-11-30
        • 1970-01-01
        • 2013-03-11
        • 2018-10-19
        相关资源
        最近更新 更多