Generate the JPA metamodel files using maven-processor-plugin - What is a convenient way for re-generation?

前端 未结 3 1703
无人及你
无人及你 2020-12-14 12:38

I am trying to use maven-processor-plugin for generating JPA metamodel java files and I set up my pom.xml as belows.


        

        
3条回答
  •  [愿得一人]
    2020-12-14 13:29

    i have also a working solution and i want to share this one with others. so i hope that is the correct place for this.

    the code can be found at GitHub https://github.com/StefanHeimberg/jpa21-maven-metagen

    features:

    • JPA 2.1
    • Example with Hibernate Metamodel Generator
    • Example with EclipseLink Metamodel Generator
    • Minimal Maven configuration for IntelliJ (Tested with 14.1.4) and NetBeans (Tested with 8.1)
    • M2E Workaround for Eclipse (Tested with 4.5.1) (Automatic profile activation)

    pom.xml:

    
    
    
        4.0.0
    
        com.github.stefanheimberg
        jpa21-maven-metagen
        1.0-SNAPSHOT
        jar
    
        
            UTF-8
            1.8
            1.8
        
    
        
            
                javax
                javaee-api
                7.0
                provided
            
        
    
        
            
                hibernate
                
                    true
                
                
                    5.0.3.Final
                
                
                    
                        org.hibernate
                        hibernate-jpamodelgen
                        ${hibernate.version}
                        provided
                    
                
            
    
            
                eclipselink
                
                    false
                
                
                    2.6.1
                
                
                    
                        org.eclipse.persistence
                        org.eclipse.persistence.jpa.modelgen.processor
                        ${eclipselink.version}
                        provided
                    
                
            
    
            
                m2e
                
                    
                        m2e.version
                    
                
                
                    
                        
                            
                            
                                org.eclipse.m2e
                                lifecycle-mapping
                                1.0.0
                                
                                    
                                        
                                            
                                                
                                                    
                                                        org.codehaus.mojo
                                                    
                                                    
                                                        build-helper-maven-plugin
                                                    
                                                    
                                                        [1.9.1,)
                                                    
                                                    
                                                        add-source
                                                    
                                                
                                                
                                                    
                                                        true
                                                        true
                                                    
                                                
                                            
                                        
                                    
                                
                            
                        
                    
                    
                        
                            org.codehaus.mojo
                            build-helper-maven-plugin
                            1.9.1
                            
                                
                                    add-source
                                    generate-sources
                                    
                                        add-source
                                    
                                    
                                        
                                            ${project.build.directory}/generated-sources/annotations/
                                        
                                    
                                
                            
                        
                    
                
            
        
    
    

提交回复
热议问题