Prerequisite: use EclipseLink
Add the following to your pom.xml file:
<dependency> <groupId>org.eclipse.persistence</groupId> <artifactId>eclipselink</artifactId> <version>2.5.1</version> <scope>provided</scope> </dependency>
First step: Modify your pom.xml file
The pom.xml file has to be modified to include the following plugin:
<plugin> <groupId>org.bsc.maven</groupId> <artifactId>maven-processor-plugin</artifactId> <version>2.2.4</version> <executions> <execution> <id>process</id> <goals> <goal>process</goal> </goals> <phase>generate-sources</phase> <configuration> <processors> <processor>org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor</processor> </processors> <outputDirectory>${project.build.directory}/generated-sources/meta-model</outputDirectory> </configuration> </execution> </executions> <dependencies> <dependency> <groupId>org.eclipse.persistence</groupId> <artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId> <version>2.6.1</version> </dependency> </dependencies> </plugin>
Second step: add the Generated-sources folder
Then, open the project properties and move to Java Build Path. In the "Source" tab, select "Add folder" and then add "target/generated-sources".
Build the project.
Third step: compile
Finally, again in project properties, select the JPA menu, select EclipseLink as a platform, allow Discover annotated classes automatically, and then press Apply. From this point on, the generated-sources folder should contain your compiled metamodel.
Nessun commento:
Posta un commento