Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Update groupId, version, and plugin information

Using the openjpa-maven-plugin

There is a The Maven plugin, formerly provided by the Codehaus project , which uses OpenJPA to enhance entities during a Maven build.is now part of OpenJPA 2.2.0. The plugins documentation can be found here until it finds a permanent home one the openjpa site.

The previous versions of the plugin can be found at the Codehaus project

For example, to enhance you source entity classes after they have been compiled (but exclude any POJO classes that rely upon orm.xml maappings), add the openjpa-maven-plugin to the <build> section of your pom.xml, like -

Code Block
    <build>
        ...
        <plugin>
            <groupId>org.codehausapache.mojo<openjpa</groupId>
            <artifactId>openjpa-maven-plugin</artifactId>
            <version>1.0<<version>2.2.0-SNAPSHOT</version>
            <configuration>
                <includes>**/entities/*.class</includes>
                <excludes>**/entities/XML*.class</excludes>
                <addDefaultConstructor>true</addDefaultConstructor>
                <enforcePropertyRestrictions>true</enforcePropertyRestrictions>
            </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>
                    <!-- set the version to be the same as the level in your runtime -->
                    <version>1.2.2</version>
                </dependency>
            </dependencies>
        </plugin>
        ...
    </build>

...