openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Woods <dwo...@apache.org>
Subject Re: Open jpa 2.0 and maven build
Date Wed, 10 Mar 2010 20:15:17 GMT
I'm using the latest openjpa-maven-plugin-1.1-SNAPSHOT (you have to
build it yourself) with some junits in OpenJPA trunk and it's working
for me with a 2.0 persistence.xml and openjpa-2.0.0-SNAPSHOT (2.0.0-beta
or 2.0.0-beta2 should work too).  You should be able to use the existing
openjpa-maven-plugin-1.0 as well, with phase=process-classes and
goals=enhance (as the enhancing test classes is only in the unreleased
1.1-SNAPSHOT version.)

>From persistence.xml -
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    version="2.0">

>From my pom.xml -
. . .
<build>
    . . .
            <!-- new way of using openjpa-maven-plugin to enhance
classes -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>openjpa-maven-plugin</artifactId>
                <version>1.1-SNAPSHOT</version>
                <configuration>

<includes>org/apache/openjpa/integration/daytrader/*Bean.class</includes>

<excludes>org/apache/openjpa/persistence/**/*.class</excludes>
                    <addDefaultConstructor>true</addDefaultConstructor>

<enforcePropertyRestrictions>true</enforcePropertyRestrictions>
                </configuration>
                <executions>
                    <execution>
                        <id>enhancer</id>
                        <!-- phase used to enhance source
                        <phase>process-classes</phase>
                        -->
                        <!-- phase used to enhance tests -->
                        <phase>process-test-classes</phase>
                        <goals>
                            <!-- goal used to enhance source
                            <goal>enhance</goal>
                            -->
                            <!-- goal used to enhance tests -->
                            <goal>test-enhance</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.openjpa</groupId>
                        <artifactId>openjpa</artifactId>
                        <version>${pom.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
    . . .
</build>


-Donald


On 3/10/10 2:46 PM, Pmoran wrote:
> 
> Thanks for your response. You sure this works and compiles a openJPA 2.0
> project? 
> The openjpa-maven-plugin states that unless you add the openJPA version to
> its configuaration it will default to 1.2.0
> In fact when I set the OPENJPA property openjpa.specification to JPA2.0 I
> get an error saying the project is already 1.0 and cannot be changed to 2.0!
> 
> So maybe my problem is (somehow) I have made my project a project JPA 1.0.
> So my question is how does one (or in this case - me) do this?
> 
> I have also upgrades my persistence.xml to version 2.0 from the original 1.0
> thinking that may be the culprit

Mime
View raw message