2014-03-28 41 views
0

我正在使用Maven通過wsdl文件從SOAP Web服務器生成代碼。導入Maven生成的代碼

我的問題:生成的代碼無法編譯,因爲導入不良。 無法解析所有'fr.norsys.asoape.xml'鏈接。

我的pom.xml包含這些行:

<properties> 
    <asoape.version>1.1</asoape.version> 
</properties> 

<plugin> 
    <groupId>fr.norsys.asoape</groupId> 
    <artifactId>asoape-maven-plugin</artifactId> 
    <version>${asoape.version}</version> 
    <executions> 
     <execution> 
      <goals> 
       <goal>generate-soap-stub</goal> 
      </goals> 
      <phase>generate-sources</phase> 
     </execution> 
    </executions> 
</plugin> 

<dependency> 
    <groupId>fr.norsys.asoape</groupId> 
    <artifactId>runtime-library</artifactId> 
    <version>${asoape.version}</version> 
    <scope>system</scope> 
    <systemPath>${basedir}/libs/runtime-library-1.1-sources.jar</systemPath> 
</dependency> 

我這麼想嗎?

UPDATE

由於tdrury的建議,現在我用我自己的包,Eclipse可以resiolve 「fr.norsys.asoap.xml.binding.annotation」!但不是XmlType,XmlElement,XmlRootElement ...它們都是這個包的一部分。

這怎麼可能?知道一個包,但不知道他的內容?

+1

這將幫助,如果你提供的類與不良的進口/包。如果您取得其中一個缺失類的全限定類名並轉到maven central(http://search.maven.org/),請單擊高級搜索,將您的完全限定類名放入「Classname」字段並搜索它會找到該類的工件。然後在POM中包含該工件作爲依賴項。沖洗並重復,直到所有類都解決。 – tdrury

+0

好的,謝謝你我已經找到了要導入的軟件包,它現在已經包含在我的項目中。我可以手工輸入,但是maven不會。 我使用新版本的POM文件編輯我的問題 – Paradise228

回答

0

我不知道爲什麼,但我不能編輯我的第一條消息... 這裏是POM

<properties> 
    <asoape.version>1.1</asoape.version> 
</properties> 

<plugin> 
    <groupId>fr.norsys.asoape</groupId> 
    <artifactId>asoape-maven-plugin</artifactId> 
    <version>${asoape.version}</version> 
    <executions> 
     <execution> 
      <goals> 
       <goal>generate-soap-stub</goal> 
      </goals> 
      <phase>generate-sources</phase> 
     </execution> 
    </executions> 
</plugin> 

<dependency> 
     <groupId>fr.norsys.asoape</groupId> 
     <artifactId>runtime-library</artifactId> 
     <version>${asoape.version}</version> 
     <scope>system</scope> 
     <systemPath>${basedir}/libs</systemPath> 
</dependency> 
+1

systemPath應該指向jar本身,而不僅僅是jar所在的目錄。 – tdrury

+0

是的,我計算出來了。 但問題仍然存在 – Paradise228