Maven JAXB2插件提供了一個配置來指定一個自定義的包名稱。也許這對你有幫助。
<configuration>
...
<generatePackage>my.own.packagename</generatePackage>
...
</configuration>
在這裏看到更多的信息
http://confluence.highsource.org/display/MJIIP/User+Guide#UserGuide-Controllingtheoutput
更新:
如果你有多個命名空間,你可以使用這樣的裝訂文件夾:
<?xml version="1.0" encoding="UTF-8"?>
<jaxb:bindings xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" version="1.0">
<jaxb:bindings schemaLocation="..."
node="//xsd:schema[@targetNamespace='http://demo.ws/address']">
<jaxb:schemaBindings>
<jaxb:package name="demo.ws.address" />
</jaxb:schemaBindings>
</jaxb:bindings>
<jaxb:bindings schemaLocation="..."
node="//xsd:schema[@targetNamespace='http://demo.ws/name']">
<jaxb:schemaBindings>
<jaxb:package name="demo.ws.name" />
</jaxb:schemaBindings>
</jaxb:bindings>
</jaxb:bindings>
Thi S結合文件可以在插件配置進行設置:
<configuration>
...
<bindingDirectory>...</bindingDirectory>
<bindingIncludes>
<include>*.xjb</include>
</bindingIncludes>
...
</configuration>
謝謝回答,我知道在這個JAXB的配置,但它不能幫助,因爲我有這麼多類具有相同名稱且有當一切都在一個包中生成時發生衝突。最後,我不得不離開jaxb生成基於命名空間的類,然後修改程序包 – user1806952 2014-09-28 10:07:33
也許綁定文件就是你要找的。看到我更新的答案。 – DirkNM 2014-09-28 13:24:15
由於在一個項目中有很多模式,大約100個,我擺脫了綁定文件之前,文件有點混亂,難以維護,因爲一個單一的xsd必須在此文件中指定並映射到包 – user1806952 2014-09-29 08:03:58