2011-06-23 49 views
0

我有一個maven構建,它會自動生成一組JAXB java源文件。其基本配置是maven jaxb2插件 - 我可以避免jwsdp依賴

<plugin> 
    <groupId>org.jvnet.jaxb2.maven2</groupId> 
    <artifactId>maven-jaxb2-plugin</artifactId> 
    <version>0.7.5</version> 
    <executions> 
     <execution> 
      <goals> 
       <goal>generate</goal> 
      </goals> 
     </execution> 
    </executions> 
    <configuration> 
     <includeSchemas> 
      <includeSchema>*.xsd</includeSchema> 
     </includeSchemas> 
     <excludeSchemas> 
      <excludeSchema>test*.xsd</excludeSchema> 
     </excludeSchemas> 
     <includeBindings> 
      <includeBinding>*.xjb</includeBinding> 
     </includeBindings> 
     <strict>false</strict> 
     <verbose>true</verbose> 
     <debug>true</debug> 
     <extension>true</extension> 
     <!-- http://stackoverflow.com/questions/1999163/how-to-use-jaxb-commons-plugins-from-maven --> 
     <args> 
      <arg>-Xinheritance</arg> 
     </args> 
    </configuration> 
    <dependencies> 
     <dependency> 
      <groupId>org.jvnet.jaxb2_commons</groupId> 
      <artifactId>jaxb2-basics</artifactId> 
      <version>0.6.1</version> 
     </dependency> 
     <dependency> 
      <groupId>org.jvnet.jaxb2_commons</groupId> 
      <artifactId>jaxb2-basics-runtime</artifactId> 
      <version>0.6.1</version> 
     </dependency> 
    </dependencies> 
</plugin> 

如果我跑「Maven的清包」的源文件被正確地產生,但是過程進行到嘗試和下載這些罐子。我意識到我可以從Maven JAXB Plug-in頁面上列出的說明手動安裝所需的罐子,但我想知道是否有避免Sun Web服務jar依賴關係的另一種方法。我應該爲JAXP還是maven插件使用不同的版本?

Downloading: http://host/archiva/repository/internal/jwsdp/jaxb-api/jwsdp.1.5/jaxb-api-jwsdp.1.5.pom 
[INFO] Unable to find resource 'jwsdp:jaxb-api:pom:jwsdp.1.5' in repository central (http://host/archiva/repository/internal) 
Downloading: http://host/archiva/repository/internal/jwsdp/jaxb-api/jwsdp.1.5/jaxb-api-jwsdp.1.5.pom 
[INFO] Unable to find resource 'jwsdp:jaxb-api:pom:jwsdp.1.5' in repository java.net (http://host/archiva/repository/internal) 
Downloading: http://host/archiva/repository/internal/jwsdp/jaxb-api/jwsdp.1.5/jaxb-api-jwsdp.1.5.pom 
[INFO] Unable to find resource 'jwsdp:jaxb-api:pom:jwsdp.1.5' in repository java.net2 (http://host/archiva/repository/internal) 
Downloading: http://host/archiva/repository/internal/jwsdp/jaxb-impl/jwsdp.1.5/jaxb-impl-jwsdp.1.5.pom 
[INFO] Unable to find resource 'jwsdp:jaxb-impl:pom:jwsdp.1.5' in repository central (http://host/archiva/repository/internal) 
Downloading: http://host/archiva/repository/internal/jwsdp/jaxb-impl/jwsdp.1.5/jaxb-impl-jwsdp.1.5.pom 
[INFO] Unable to find resource 'jwsdp:jaxb-impl:pom:jwsdp.1.5' in repository java.net (http://host/archiva/repository/internal) 
Downloading: http://host/archiva/repository/internal/jwsdp/jaxb-impl/jwsdp.1.5/jaxb-impl-jwsdp.1.5.pom 
[INFO] Unable to find resource 'jwsdp:jaxb-impl:pom:jwsdp.1.5' in repository java.net2 (http://host/archiva/repository/internal) 
Downloading: http://host/archiva/repository/internal/jwsdp/jaxb-xjc/jwsdp.1.5/jaxb-xjc-jwsdp.1.5.pom 
[INFO] Unable to find resource 'jwsdp:jaxb-xjc:pom:jwsdp.1.5' in repository central (http://host/archiva/repository/internal) 
Downloading: http://host/archiva/repository/internal/jwsdp/jaxb-xjc/jwsdp.1.5/jaxb-xjc-jwsdp.1.5.pom 
[INFO] Unable to find resource 'jwsdp:jaxb-xjc:pom:jwsdp.1.5' in repository java.net (http://host/archiva/repository/internal) 
Downloading: http://host/archiva/repository/internal/jwsdp/jaxb-xjc/jwsdp.1.5/jaxb-xjc-jwsdp.1.5.pom 
[INFO] Unable to find resource 'jwsdp:jaxb-xjc:pom:jwsdp.1.5' in repository java.net2 (http://host/archiva/repository/internal) 
Downloading: http://host/archiva/repository/internal/jwsdp/jaxb-libs/jwsdp.1.5/jaxb-libs-jwsdp.1.5.pom 
[INFO] Unable to find resource 'jwsdp:jaxb-libs:pom:jwsdp.1.5' in repository central (http://host/archiva/repository/internal) 
Downloading: http://host/archiva/repository/internal/jwsdp/jaxb-libs/jwsdp.1.5/jaxb-libs-jwsdp.1.5.pom 
[INFO] Unable to find resource 'jwsdp:jaxb-libs:pom:jwsdp.1.5' in repository java.net (http://host/archiva/repository/internal) 
Downloading: http://host/archiva/repository/internal/jwsdp/jaxb-libs/jwsdp.1.5/jaxb-libs-jwsdp.1.5.pom 

回答

1

我不明白你從哪裏得到這些jwsdp:jaxb-libs依賴關係。你如何認識到你需要他們?也許這些sample projects其中之一可能對您的入門有所幫助。您的項目無需

<dependency> 
     <groupId>com.sun.xml.bind</groupId> 
     <artifactId>jaxb-impl</artifactId> 
     <version>${jaxb.version}</version> 
    </dependency> 

作爲依賴關係。如果您使用的是JAXB2基礎知識,那麼您還需要:

<dependency> 
     <groupId>org.jvnet.jaxb2_commons</groupId> 
     <artifactId>jaxb2-basics-runtime</artifactId> 
     <version>${project.version}</version> 
    </dependency> 

您通常不需要jwsdp作爲依賴關係。但也許我錯過了一些東西。

接下來,此插件:http://maven-plugins.sourceforge.net/maven-jaxb-plugin/與您正在使用的maven-jaxb2-plugin沒有任何關係。

最後,我建議添加JAXB插件爲configuration/plugins,而不是作爲依賴關係。見this guide

+0

謝謝你。在生成階段正確執行之後,maven命令「clean compile」似乎將jwsdp作爲依賴項拖入。我不明確地在我的pom.xml中包含jwsdp,我必須檢查運行mvn進程的類路徑以查看是否存在某個問題。 – emeraldjava

+1

嘗試'mvn依賴:樹'。 – lexicore