Hi. after bashing my head for awhile against the PCEnhancer, it looks like it really needs a way to take in the class path where to work with entities instead of relying on current class path. The problem is with a simple task:
<target name="openjpa.enhance"> <taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask" classpathref="war.classpath" /> <openjpac directory="${artifact.output.path}/WEB-INF/classes"> <fileset dir="src/java"> <include name="com/excelfore/entity/E_*.java"/> </fileset> </openjpac> </target> The classpath defined in <taskdef> is not used to find the entity classes, instead system class loader is used, and that class loader doesn't have access to the entity classes. For this task to work, the ant must be started with the class path sufficient to reach the entities. Normally, during build time, these things don't exist yet, and normally, you would expect the enhancer to be a part of a larger build. Thank you, Pawel.