As of this writing the OpenJPA Plugin provides 3 goals to cope with persistence-enabled classes in a project using Maven 2.
All these OpenJPA Mojos expect the following resources to be present on classpath:
OpenJPA documentation is available here.
Below is an OpenJPA plugin configuration example.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>openjpa-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<includes>com/myproject/entities/**/*.class</includes>
<addDefaultConstructor>true</addDefaultConstructor>
<enforcePropertyRestrictions>true</enforcePropertyRestrictions>
<!-- Pass additional properties to the Plugin here -->
<toolProperties>
<property>
<name>directory</name>
<value>otherdirectoryvalue</value>
</property>
</toolProperties>
</configuration>
<executions>
<execution>
<id>enhancer</id>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>
</plugin>
From the command prompt/terminal window.
mvn openjpa:enhance
mvn openjpa:sql
mvn openjpa:schema