2012-03-23 118 views
0

當我嘗試編譯我的程序。我收到以下錯誤信息:Maven JAX-WS WSGEN「Class not found error」

Failed to execute goal org.jvnet.jax-ws-commons:jaxws-maven-plugin:2.2:wsgen (generate-wsdl) on project SimpleWebServices: Error executing: wsgen [-keep, -s, etc.......... 

於是,我開始閒逛,並進一步向上的錯誤,我看到:

Class not found: "com.test.ws.services.SimpleServiceImpl" 

這樣看來,由於某種原因,該WSGEN找不到我值。有沒有人有任何想法?

這裏是我的POM如果有興趣...

 <plugin> 
      <groupId>org.jvnet.jax-ws-commons</groupId> 
      <artifactId>jaxws-maven-plugin</artifactId> 
      <version>2.2</version> 
      <executions> 
       <execution> 
        <id>generate-wsdl</id> 
        <phase>process-classes</phase> 
        <goals> 
         <goal>wsgen</goal> 
        </goals> 
        <configuration> 
         <sei>com.test.ws.services.SimpleServiceImpl</sei> 
         <genWsdl>true</genWsdl> 
         <verbose>true</verbose> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 

用戶編輯:(基於@Thomas建議) 我覺得我得到它。看來我沒有在POM Build區域中指定源文件夾。導致我的源代碼不被編譯。

添加:

<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory> 

奏效了我。

@Thomas如果您發佈您的答案,我很樂意爲您提供答案。

感謝您的回覆,

+1

看起來像一個類路徑問題,你是否有包含SimpleServiceImpl的包? – Thomas 2012-03-23 19:07:44

+0

你的意思是'SimpleServiceImpl'也生成了(因爲'$ {project.basedir}'是'target /'dir)? – 2012-03-25 14:46:45

+0

我的代碼沒有被編譯(我起初沒有注意到)。所以在POM中,我指定了sourceDirectory。這似乎包括我的源代碼在編譯中,其餘的是歷史.... – n00bish 2012-03-26 14:47:47

回答

1

只使用

mvn clean compile jaxws:wsgen 

,而不是

mvn clean jaxws:wsgen 

的問題是,沒有可用的編譯版本。 wsgen將用於類路徑,如帶有ByteCode的JAR。

sourceDirectory${project.basedir}/src/main/java是maven的默認設置,所以您不必一定設置它。

相關問題