JPOX
JPOX
 Project  |  Ver 1.1  |  Ver 1.2  |  JDO  |  JPA  |  Guides  |  Tools
JPOX Guides
JDO Guides
JPA Guides
JPOX and Maven2

Apache Maven is a project management and build tool that is quite common in organisations. It continues on from where Maven1 left off though not providing backwards compatibility with Maven1.

Repository

The main thing that you need to bear in mind is that JPOX jars are present in JPOX own Maven repository so all you need to do is point your Maven2 project at this repository. You do this by including the following in your pom.xml

<project>
    ...

    
    <repositories>
        <repository>
            <id>JPOX_Repos</id>
            <name>JPOX Repository</name>
            <url>http://www.jpox.org/downloads/maven</url>
            <layout>legacy</layout>
        </repository>
        <repository>
            <id>JPOX_Repos2</id>
            <name>JPOX Repository</name>
            <url>http://www.jpox.org/downloads/maven2</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>JPOX_2</id>
            <url>http://www.jpox.org/downloads/maven2/</url>
        </pluginRepository>
    </pluginRepositories>
</project>

So this make the JPOX Maven1 and Maven2 repositories available, and also makes the JPOX Maven2 plugin available.





Maven2 Plugin

Now that you have the JPOX jars available to you, via the repositories, you want to perform JPOX operations. The primary operations are enhancement and SchemaTool (for RDBMS). To run the enhancer you do

mvn JPOX:enhance
                

If you want this to be done automatically after compiling then you should add the following into your pom.xml

<project>
    ...
    <build>
        <plugins>
            <plugin>
                <groupId>jpox</groupId>
                <artifactId>maven-jpox-plugin</artifactId>
                <version>1.0-SNAPSHOT</version>
                <configuration>
                    <mappingIncludes>**/*.jdo, **/*.class</mappingIncludes>
                    <log4jConfiguration>${basedir}/log4j.properties</log4jConfiguration>
                    <verbose>true</verbose>
                    <enhancerName>ASM</enhancerName>
                    <props>${basedir}/JPOX.properties</props>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>enhance</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugin>
    </build>
</project>

So whenever compile takes place it then does an enhance using the JPOX Maven2 plugin.

SchemaTool is achieved similarly, via

mvn jpox:schema-create