The EclipseLink Maven Plugin is designed to streamline the workflow for EclipseLink JPA developers by automating essential configuration and generation tasks.
- Automated Meta-Model Generation: Eliminates the need to configure a dedicated APT processor for canonical model generation. Simply execute the
modelgengoal. - Dynamic
persistence.xmlGeneration: Allows you to bypass thepersistence.xmlfile entirely. Entity classes are detected automatically, and the required persistence file is generated during the build process. - Automatic Class Registration: If a
persistence.xmlfile already exists, any missing<class>...</class>entries are appended automatically. This enables a minimal baseline configuration without the maintenance overhead of manual class registration.
- 4.x Releases: Target the
jakarta.*namespace and Eclipselink 5.x. - 3.x Releases: Target the
jakarta.*namespace. - 2.x Releases: Target the
javax.*namespace.
<plugin>
<groupId>com.ethlo.persistence.tools</groupId>
<artifactId>eclipselink-maven-plugin</artifactId>
<version>${eclipselink-maven-plugin.version}</version>
<configuration>
<basePackages>
<basePackage>com.yourcompany.project</basePackage>
</basePackages>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>weave</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.ethlo.persistence.tools</groupId>
<artifactId>eclipselink-maven-plugin</artifactId>
<version>${eclipselink-maven-plugin.version}</version>
<configuration>
<basePackages>
<basePackage>com.yourcompany.project</basePackage>
</basePackages>
</configuration>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>modelgen</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.ethlo.persistence.tools</groupId>
<artifactId>eclipselink-maven-plugin</artifactId>
<version>${eclipselink-maven-plugin.version}</version>
<configuration>
<basePackages>
<basePackage>org.my.projectA</basePackage>
<basePackage>org.my.projectB</basePackage>
</basePackages>
</configuration>
<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>
</plugin>