Hi Gul,

There is a maven 2 plugin available, but it was based on the OpenJPA
0.9.6 (or 0.9.5) incubating code. I don't know if it's been updated
since then. You can find instructions on how to use it here :
http://openjpa.apache.org/enhancingwithmaven.html

The OpenJPA unit tests use the maven antrun plugin to enhance our
entities. Here's the relevant section from our pom.xml :

<plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>test-compile</phase>
                        <configuration>
                            <tasks>
                                <path id="cp">
                                    <path refid="maven.test.classpath"/>
                                    <path refid="maven.compile.classpath"/>
                                    <path refid="maven.dependency.classpath"/>
                                </path>
                                <taskdef name="openjpac" classname=
                                    "org.apache.openjpa.ant.PCEnhancerTask">
                                    <classpath refid="cp"/>
                                </taskdef>
                                <fileset id="enhance.path.ref"
                                    dir="${project.build.testOutputDirectory}">
                                    <include name="**/*.class"/>
                                    <exclude
name="**/inheritance/serializable/*.class"/>
                                    <exclude name="**/xml/*.class"/>
                                    <exclude name="**/Unenhanced*.class"/>
                                </fileset>
                                <openjpac>
                                    <classpath refid="cp"/>
                                    <fileset refid="enhance.path.ref"/>
                                    <config
log="DefaultLevel=${openjpa.loglevel}"/>
                                </openjpac>
                                <!-- snip -->
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

I believe either approach will enhance your entities before they are
packaged, but it might take a bit of experimentation to get it right
for your environment.

I hope this is at least a good starting point for you,

-Mike


On Oct 31, 2007 10:58 PM, Gul Onural <[EMAIL PROTECTED]> wrote:
>
>
> I am trying to understand how openjpa enhancer can be run as part of a
> maven loadbuild.
> Did anyone do this before ?
>
> Gul
>

Reply via email to