2012-01-06 57 views
4

我在使用netbeans與maven 3.當我嘗試使用jaxws-maven-plugin編譯時,出現以下錯誤。maven jaxws無法執行wsgen

這裏是我的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] 

回答

11

作爲第一步,請確保您正在運行的Maven用正確的Java版本 - JAXWS:WSGEN(1.12)出現與Java 7的發生故障,在這種情況下使用Java 6中,即:

如果你從一個shell中運行它
  • export JAVA_HOME=/path/to/java/6
  • ,如果你從一個IDE運行它,在IDE啓動時指定java版本
    • 例如,爲日食,使用啓動選項-vm /path/to/java/6

對於我來說,這個解決造成com.sun.xml.bind.v2.runtime.IllegalAnnotationsExceptionFailed to execute wsgen

+0

開關從Java 8到Java 7的固定對我來說。 – 2014-11-10 16:40:06

10

嘗試使用JAX-WS公共項目插件的更新版本。

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

該項目剛回到MojoHaus,所以你應該使用there的最新版本。

  1. < 2007:1.0-1.12(的groupId org.codehaus.moj O)
  2. 2007 - 2015年:2.1-2.3.1(的groupId org.jvnet.jax-WS-公地
  3. 2015-今天:> = 2.4(的groupId org.codehaus.mojo

最初的代碼是在Codehaus Mojo項目中開發的,到2007年3月,該項目轉移到org中的org.codehaus.mojo groupId和2.x版本的1.x版本的jax-ws-commons。 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> 
相關問題