Eclipselink JPA maven plugin made to simplify life of the Eclipselink JPA developer.
- No need to setup special APT processor for canonical model generation, just use goal
modelgen
. - Allows you to get rid of the
persistence.xml
file as the classes are detected automatically and a persistence.xml file is generated. - If the
persistence.xml
file already exists, missing<class>...</class>
entries are added automatically. This allows you to have a basic configuration, but you do not have to manually add class entries.
A simple test project can be found here
Static weaving:
<plugin>
<groupId>com.ethlo.persistence.tools</groupId>
<artifactId>eclipselink-maven-plugin</artifactId>
<version>${eclipselink-maven-plugin.version}</version>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>weave</goal>
</goals>
</execution>
</executions>
</plugin>
Meta-model generation:
<plugin>
<groupId>com.ethlo.persistence.tools</groupId>
<artifactId>eclipselink-maven-plugin</artifactId>
<version>${eclipselink-maven-plugin.version}</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>modelgen</goal>
</goals>
</execution>
</executions>
</plugin>
Both weave, DDL and meta-model generation and setting basePackages
:
<plugin>
<groupId>com.ethlo.persistence.tools</groupId>
<artifactId>eclipselink-maven-plugin</artifactId>
<version>${eclipselink-maven-plugin.version}</version>
<executions>
<execution>
<id>weave</id>
<phase>process-classes</phase>
<goals>
<goal>weave</goal>
</goals>
</execution>
<execution>
<id>ddl</id>
<phase>process-classes</phase>
<goals>
<goal>ddl</goal>
</goals>
<configuration>
<databaseProductName>mysql</databaseProductName>
</configuration>
</execution>
<execution>
<id>modelgen</id>
<phase>generate-sources</phase>
<goals>
<goal>modelgen</goal>
</goals>
</execution>
</executions>
<configuration>
<basePackages>
<basePackage>org.my.projectA</basePackage>
<basePackage>org.my.projectB</basePackage>
</basePackages>
</configuration>
</plugin>