maven jaxws执行wsgen失败

use*_*201 4 jax-ws maven

我正在使用带有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>
Run Code Online (Sandbox Code Playgroud)

这是我收到的错误消息.我试图使用系统范围依赖添加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]
Run Code Online (Sandbox Code Playgroud)

cha*_*lie 12

作为第一步,确保你使用正确的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

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


Ami*_*ila 10

尝试使用JAX-WS commons项目中的插件的更新版本.

<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.2</version>
Run Code Online (Sandbox Code Playgroud)