Is there a way to deal with duplicate element definitions across multiple .xsd files in JAXB?

后端 未结 5 1999
予麋鹿
予麋鹿 2020-12-05 05:35

I have dozens and dozens .xsd files that I want to auto-generate code for. A couple of the files have duplicate names that clash when I try to generate all of t

5条回答
  •  时光说笑
    2020-12-05 06:02

    We had a similar problem: we had one wsdl file and two xsd files in the same directory. The wsdl file imports the two xsd files. The problem was that JAXB was taking all three files into consideration and throwing '... is already defined' error. It was basically complaining that it saw the same element in both wsdl and xsd file.

    We could fix this issue in the maven plugin configuration (in pom.xml) by adding an exclude tag as in the following example:

        
        
            
                org.jvnet.jaxb2.maven2
                maven-jaxb2-plugin
                0.12.3
                
                    
                        
                            generate
                        
                    
                
                
                    WSDL
                    mywsdl.wsdl
                    -XautoNameResolution
                    
                        
                            
                                
                                    *.xsd
                                
                            
                        
                    
                
            
        
    
    

提交回复
热议问题