How can I tell jaxb / Maven to generate multiple schema packages?

前端 未结 9 1847
旧时难觅i
旧时难觅i 2020-11-28 03:16

Example:

       
       
           org.jvnet.jaxb2.maven2         


        
9条回答
  •  野性不改
    2020-11-28 03:27

    I encountered a lot of problems when using jaxb in Maven but i managed to solve your problem by doing the following

    First create a schema.xjc file

    
    
        
            
                
            
        
        
            
                
            
        
    
    

    The package name can be anything you want it to be, as long as it doesn't contain any reserved keywords in Java

    Next you have to create the wsimport.bat script to generate your packaged and code at the preferred location.

    cd C:\YOUR\PATH\TO\PLACE\THE\PACKAGES
    wsimport -keep -verbose -b "C:\YOUR\PATH\TO\schema.xjb" YOUR_URL?wsdl
    pause
    

    If you do not want to use cd, you can put the wsimport.bat in "C:\YOUR\PATH\TO\PLACE\THE\PACKAGES"

    If you run it without -keep -verbose it will only generate the packages but not the .java files.

    The -b will make sure the schema.xjc is used when generating

提交回复
热议问题