3
我們有一個項目定義了它使用XSD文件生成的消息格式。Maven - 將XSD作爲依賴關係
將這些XSD文件作爲另一個項目的依賴關係的最簡單方法是什麼?
我在看使用maven-build-helper attach-artifact目標來附加我的XSD文件。
有沒有更好的機制?
我們有一個項目定義了它使用XSD文件生成的消息格式。Maven - 將XSD作爲依賴關係
將這些XSD文件作爲另一個項目的依賴關係的最簡單方法是什麼?
我在看使用maven-build-helper attach-artifact目標來附加我的XSD文件。
有沒有更好的機制?
我不知道attach-artifact的目標,但我做了一些像你一樣的要求。我有wsdl和xsd文件用axis2編寫Webservice工件及其客戶端工件。
我把所有這些項目放到一個多模塊項目中,以便我可以一起構建所有項目。 我想對你重要的部分是依賴-插件的配置:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-wsdl-dependency</id>
<phase>initialize</phase>
<goals>
<goal>unpack</goal>
</goals>
</execution>
</executions>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${groupId}</groupId>
<artifactId>wsdl</artifactId>
<outputDirectory>target/wsdl</outputDirectory>
<includes>META-INF/*.wsdl,META-INF/*.xsd</includes>
</artifactItem>
</artifactItems>
<!-- other configurations here -->
</configuration>
</plugin>
希望有所幫助。
問候邁克爾
您是否希望項目包裝類型爲xsd而不是jar或pom? – sblundy 2010-12-08 16:25:57
attach-artifact的目標是一樣的好。其他解決方案將以更復雜的方式完成同樣的事情:-) – 2010-12-08 16:32:48