我正在使用带有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]
答案 0 :(得分:12)
作为第一步,确保您使用正确的java版本运行maven - jaxws:wsgen (1.12)似乎与 java 7 一起出现故障,这种情况使用 java 6 ,即:
export JAVA_HOME=/path/to/java/6
-vm /path/to/java/6
对我来说,这解决了由Failed to execute wsgen
引起的com.sun.xml.bind.v2.runtime.IllegalAnnotationsException
。
答案 1 :(得分:10)
尝试使用JAX-WS commons项目中插件的更新版本。
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.2</version>
答案 2 :(得分:1)
该项目刚回到MojoHaus,所以你应该使用there的最新版本。
原始代码是在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>