JPA Hibernate Metamodel generation through maven

前端 未结 1 1131
孤独总比滥情好
孤独总比滥情好 2020-12-28 19:11

I followed the JPA modelgen guide and i was able to generate the canonical metamodel which i need. With this pom set up:


                

        
相关标签:
1条回答
  • 2020-12-28 19:38

    I'm also using JPA Metamodel generator and I don't have the problems you describe, maybe my configuration can help, I see some differences, the first one is maven-processor-plugin

    <plugin>
      <groupId>org.bsc.maven</groupId>
      <artifactId>maven-processor-plugin</artifactId>
      <version>2.1.0</version>
      <executions>
        <execution>
          <id>process</id>
          <goals>
            <goal>process</goal>
          </goals>
          <phase>generate-sources</phase>
          <configuration>
            <processors>
              <processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor>
            </processors>
          </configuration>
        </execution>
      </executions>
      <dependencies>
        <dependency>
          <groupId>org.hibernate</groupId>
          <artifactId>hibernate-jpamodelgen</artifactId>
          <!--version>1.2.0.Final</version-->
          <version>4.3.4.Final</version>
        </dependency>
      </dependencies>
    </plugin>
    

    As you can see I had to add hibernate-jpamodelgen as dependency and the processor attribute.

    I am not sure if build-helper-maven-plugin is necessary to add the directory of generated sources to your source path. I am not using it and it works for me but maybe it's because I am using the default output path for generated sources.

    0 讨论(0)
提交回复
热议问题