JPA Hibernate Metamodel generation through maven
hibernate, jpa
Solution
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.
Problem
I followed the JPA modelgen guide and i was able to generate the canonical metamodel which i need. With this pom set up: ``` <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> <compilerArgument>-proc:none</compilerArgument> </configuration> </plugin> <plugin> <groupId>org.bsc.maven</groupId> <artifactId>maven-processor-plugin</artifactId> <version>2.0.6-redhat</version> <executions> <execution> <id>process</id> <goals> <goal>process</goal> </goals> <phase>generate-sources</phase> <configuration> <outputDirectory>target/metamodel</outputDirectory> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>1.3</version> <executions> <execution> <id>add-source</id> <phase>generate-sources</phase> <goals> <goal>add-source</goal> </goals> <configuration> <sources> <source>target/metamodel</source> </sources> </configuration> </execution> </executions> </plugin> ``` The generated source is properly created in the specified directory and i have to manually specify it as a source in the eclipse project class path to use it. When i trigger a maven the logs show `cannot find symbol` or `duplicate class` and i still get successful build. So my question is, is this expected/correct behavior in creating the metamodel? or did i miss something in the cofig? Thanks