Usage

Summary

The jpa-maven-plugin is a standard Maven plugin that helps with unit- and integration-testing JPA projects. Install it and use it like other standard Maven plugins.

Installation

Install the plugin as you would any other Maven plugin. In your <build>'s <plugins> stanza, include a <plugin> element referencing the jpa-maven-plugin:

  <plugin>
    <groupId>com.edugility</groupId>
    <artifactId>jpa-maven-plugin</artifactId>
    <version>3-SNAPSHOT</version>
    <!-- ...more to come. -->
  </plugin>

Goal selection

Please see the Goals page for more details on individual goals.

list-entity-classnames

Produces a .properties file, usually named target/generated-test-sources/jpa-maven-plugin/entityClassnames.properties, that can be used as a filter to automatically supply the list of persistent class names required by the JPA specification.

This goal binds by default to the process-test-classes phase.

Here is an example of configuring the plugin to run this goal using the defaults:

   <plugin>
     <groupId>com.edugility</groupId>
     <artifactId>jpa-maven-plugin</artifactId>
     <version>3-SNAPSHOT</version>
     <executions>
       <execution>
         <id>Generate entityClassnames.properties during the process-test-classes phase</id>
         <goals>
           <goal>list-entity-classnames</goal>
         </goals>
       </execution>
     </executions>
   </plugin>

You may bind this goal to another phase, but be aware that the goal scans class information, not source information, so it needs to be a goal that occurs after a compilation step. In practice, there is rarely a need to select a different phase.