ANT脚本中的XJC任务说“使用类自定义”

时间:2013-03-01 12:25:00

标签: ant jaxb

在SNotification.xsd上运行XJC任务时,两个XSD(SNotification.xsd,CDataModel.xsd)正在生成相同的类。它显示的错误是:

A class/interface with the same name "com.att.mre.ecrupr.atlas.jms.MarketInfo" is already in use. Use a class customization to resolve this conflict.
      [xjc]   line 214 of file:/C:/Documents%20and%20Settings/rkar4749/workspace/ECRUPR_1306/AtlasEventsListener/xsd/Atlas/Container/Public/SubscriberNotification.xsd
      [xjc] [ERROR] (Relevant to above error) another "MarketInfo" is generated from here.
      [xjc]   line 22368 of file:/C:/Documents%20and%20Settings/rkar4749/workspace/ECRUPR_1306/AtlasEventsListener/xsd/Common/Types/Public/CingularDataModel.xsd
      [xjc] [ERROR] Two declarations cause a collision in the ObjectFactory class.
      [xjc]   line 22368 of file:/C:/Documents%20and%20Settings/rkar4749/workspace/ECRUPR_1306/AtlasEventsListener/xsd/Common/Types/Public/CingularDataModel.xsd
      [xjc] [ERROR] (Related to above error) This is the other declaration.   
      [xjc]   line 214 of file:/C:/Documents%20and%20Settings/rkar4749/workspace/ECRUPR_1306/AtlasEventsListener/xsd/Atlas/Container/Public/SubscriberNotification.xsd
      [xjc] failure in the XJC task. Use the Ant -verbose switch for more details

2 个答案:

答案 0 :(得分:15)

我有同样的问题,并从终端运行以下命令,它已解决

xjc -XautoNameResolution your.xsd 

答案 1 :(得分:0)

您可以使用外部绑定文件重命名其中一个生成的类。

示例