Generating XSD schemas from JAXB types in Maven?

前端 未结 2 1392
天涯浪人
天涯浪人 2020-12-16 15:12

I\'m trying to basically generate XSD schemas from my model classes annotated in JAXB using a Maven plugin. Here\'s the relevant code in my POM:



        
2条回答
  •  一向
    一向 (楼主)
    2020-12-16 15:49

    Improving on Naftuli Tzvi Kay's answer, I found it more convenient to use the now-current version 2.2 of the jaxb2-maven-plugin, like in this sample (as the 2.x version requires slightly different configuration):

    
        org.codehaus.mojo
        jaxb2-maven-plugin
        2.2
        
            
                
                    schemagen
                
                generate-resources
                
                    
                        src/main/java/com/foo/model/xml
                    
                    ${project.build.directory}/schemas
                
            
        
    
    

    See the plugin documentation for more details.

提交回复
热议问题