Skip to content

Eclipselink JPA Maven plugin, supporting static weaving, canonical model generation, and DDL generation.

License

Notifications You must be signed in to change notification settings

ethlo/eclipselink-maven-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eclipselink-maven-plugin

Maven Central Hex.pm Codacy Badge

Eclipselink JPA maven plugin made to simplify life of the Eclipselink JPA developer.

Features

  • 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.

Versions

  • 3.x releases uses the jakarta.* packages
  • 2.x releases uses the javax.* packages

Usage

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>