How to create pojo classes from XSD?

前端 未结 3 1115
我寻月下人不归
我寻月下人不归 2021-02-02 15:35

I am using Spring maven plugin, I want to create POJO classes from specified xml schema in particular folder. I tried with xjc command through java code, but its no

3条回答
  •  既然无缘
    2021-02-02 16:12

    jaxb2-maven-plugin

    Using jaxb2-maven-plugin is the easiest way. Define the plugins as below :

    
        
            
                org.codehaus.mojo
                jaxb2-maven-plugin
                1.6
                
                    
                        
                            xjc
                        
                    
                
                
                    ${project.basedir}/src/main/xsd/
                    MARC21slim.xsd
                
            
        
    
    

    and execute :

    mvn jaxb2:xjc
    

    the generated files will be located in target\generated-sources\jaxb

提交回复
热议问题