@Subarule
私はMavenを使用していませんが、プロジェクトにはANTのみを使用しており、次のANTスクリプトはビルドの強化に役立ちます。
<target name="enhance" depends="compile">
<echo message="Enhancing...."/>
<!-- ***************************************************************************************************************** -->
<!-- DO NOT DELETE FOLLOWING CODE. THIS IS ADDED FOR ENCHANCING THE CLASSES AT COMPILE TIME. IT IS REQUIRED BY OPENJPA -->
<!-- Define the classpath to include the necessary files. -->
<!-- ex. openjpa jars, persistence.xml, orm.xml, and target classes -->
<path id="jpa.enhancement.classpath">
<!-- Assuming persistence.xml/orm.xml are in META-INF -->
<pathelement location="META-INF" />
<!-- Location of the .class files -->
<pathelement location="${build.classes}" />
<!-- Add the openjpa jars -->
<fileset dir="OpenJPA_lib_jar">
<include name="*.jar" />
</fileset>
</path>
<!-- This is a bit of a hack, but I needed to copy the persistence.xml file from my src dir
to the build dir when we run enhancement -->
<!--<copy includeemptydirs="false" todir="bin">
<fileset dir="src" excludes="**/*.launch, **/*.java"/>
</copy>-->
<!-- define the openjpac task; this can be done at the top of the -->
<!-- build.xml file, so it will be available for all targets -->
<taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask" classpathref="jpa.enhancement.classpath" />
<!-- invoke enhancer on all .class files below the model directory -->
<openjpac>
<classpath refid="jpa.enhancement.classpath" />
<fileset dir=".">
<include name="**/model/*.class" />
</fileset>
<config propertiesFile = "${basedir}/src/META-INF/persistence.xml"/>
</openjpac>
<echo message="Enhancement complete" />
<!-- ***************************************************************************************************************** -->
</target>
これがお役に立てば幸いです。