You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by David Goodenough <da...@btconnect.com> on 2009/02/11 23:01:34 UTC

maven-openjpa-plugin problem

I am trying to the the OpenJPA plugin so that I can use the static enhancer as 
part of my Maven2 build.  But when I run it it seems to be drawing in very old
versions of OpenJPA.  

Is this plugin useable with current versions of OpenJPA, and if not is there
a newer version of the mojo around anywhere?

David

Re: maven-openjpa-plugin problem

Posted by Randy Watler <wa...@wispertel.net>.
We have a multi-module build for Jetspeed2. Here are the relevant parts 
of the root pom.xml:

  ...
  <properties>
    ...
    <openjpa.version>1.2.0</openjpa.version>
    ...
  </properties>
  ...
  <dependencyManagement>
    <dependencies>
      ...
      <dependency>
        <groupId>org.apache.openjpa</groupId>
        <artifactId>openjpa-persistence-jdbc</artifactId>
        <version>${openjpa.version}</version>
        <exclusions>
          <exclusion>
            <groupId>ant</groupId>
            <artifactId>ant</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      ...        
    </dependencies>
  </dependencyManagement>
  ...
  <build>
    <pluginManagement>
      <plugins>
         ...
         <!-- OpenJPA Enhancer maven plugin -->
         <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>openjpa-maven-plugin</artifactId>
          <version>1.0-alpha</version>
          <dependencies>
            ...
            <!-- force upgrade of OpenJPA for plugin -->
            <dependency>
              <groupId>org.apache.openjpa</groupId>
              <artifactId>openjpa-persistence-jdbc</artifactId>
              <version>${openjpa.version}</version>
              <scope>runtime</scope>
            </dependency>
          </dependencies>
        </plugin>
        ...
      </plugins>
    </pluginManagement>
  </build>
  ...

Then, in our module pom.xml files:

  ...
  <dependencies>
    ...
    <dependency>
      <groupId>org.apache.openjpa</groupId>
      <artifactId>openjpa-persistence-jdbc</artifactId>
    </dependency>
    ...        
  </dependencies>
  ...
  <build>
    <plugins>
      ...
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>openjpa-maven-plugin</artifactId>
        <executions>
          ...
          <execution>
            <id>org.apache.jetspeed.jpa</id>
            <phase>process-classes</phase>
            <goals>
              <goal>enhance</goal>
            </goals>
            <configuration>
              <classes>${project.build.directory}/classes/org/apache/jetspeed/jpa</classes>
              <toolProperties>
                <property>
                  <name>addDefaultConstructor</name>
                  <value>true</value>
                </property>
                <property>
                  <name>enforcePropertyRestrictions</name>
                  <value>true</value>
                </property>
              </toolProperties>
            </configuration>
          </execution>
          ...
        </executions>
      </plugin>
      ...
    </plugins>
  </build>
  ...


HTH, good luck!

Randy Watler

Rick Curtis wrote:
> Randy -
>
> I'd like to take a look at your pom.xml.
>
> Rick
>
>
> Randy Watler wrote:
>   
>> Kevin/Rick/David:
>>
>> I believe there is a simple way to upgrade the OpenJPA version for use 
>> with the Maven2 plugin. Try adding a plugin dependency for OpenJPA with 
>> your target version. It seems to work for us over here in the Jetspeed 
>> project. We're using OpenJPA 1.2.0. Of course, YMMV. Let me know if I 
>> can help or if you want me to paste an example pom.xml here.
>>
>> Randy Watler
>>
>> Kevin Sutter wrote:
>>     
>>> Is this worth "enhancing" (pardon the pun)?  Seriously, is this maven
>>> plugin
>>> worth supporting?  Or, possibly bringing into our svn?
>>>
>>> On Wed, Feb 11, 2009 at 4:08 PM, Rick Curtis <cu...@gmail.com> wrote:
>>>
>>>   
>>>       
>>>> Dave -
>>>> I struggled with this very problem yesterday and never did get it to
>>>> work
>>>> properly. I ended up using the ant-run plugin to invoke the OpenJPA
>>>> enhancer
>>>> task.
>>>>
>>>> Rick
>>>>
>>>>
>>>> David Goodenough-3 wrote:
>>>>     
>>>>         
>>>>> I am trying to the the OpenJPA plugin so that I can use the static
>>>>> enhancer as
>>>>> part of my Maven2 build.  But when I run it it seems to be drawing in
>>>>>       
>>>>>           
>>>> very
>>>>     
>>>>         
>>>>> old
>>>>> versions of OpenJPA.
>>>>>
>>>>> Is this plugin useable with current versions of OpenJPA, and if not is
>>>>> there
>>>>> a newer version of the mojo around anywhere?
>>>>>
>>>>> David
>>>>>
>>>>>
>>>>>       
>>>>>           
>>>> --
>>>> View this message in context:
>>>> http://n2.nabble.com/maven-openjpa-plugin-problem-tp2311703p2311733.html
>>>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>>     
>>>>         
>>>   
>>>       
>>
>>     
>
>   


Re: maven-openjpa-plugin problem

Posted by Rick Curtis <cu...@gmail.com>.
Randy -

I'd like to take a look at your pom.xml.

Rick


Randy Watler wrote:
> 
> Kevin/Rick/David:
> 
> I believe there is a simple way to upgrade the OpenJPA version for use 
> with the Maven2 plugin. Try adding a plugin dependency for OpenJPA with 
> your target version. It seems to work for us over here in the Jetspeed 
> project. We're using OpenJPA 1.2.0. Of course, YMMV. Let me know if I 
> can help or if you want me to paste an example pom.xml here.
> 
> Randy Watler
> 
> Kevin Sutter wrote:
>> Is this worth "enhancing" (pardon the pun)?  Seriously, is this maven
>> plugin
>> worth supporting?  Or, possibly bringing into our svn?
>>
>> On Wed, Feb 11, 2009 at 4:08 PM, Rick Curtis <cu...@gmail.com> wrote:
>>
>>   
>>> Dave -
>>> I struggled with this very problem yesterday and never did get it to
>>> work
>>> properly. I ended up using the ant-run plugin to invoke the OpenJPA
>>> enhancer
>>> task.
>>>
>>> Rick
>>>
>>>
>>> David Goodenough-3 wrote:
>>>     
>>>> I am trying to the the OpenJPA plugin so that I can use the static
>>>> enhancer as
>>>> part of my Maven2 build.  But when I run it it seems to be drawing in
>>>>       
>>> very
>>>     
>>>> old
>>>> versions of OpenJPA.
>>>>
>>>> Is this plugin useable with current versions of OpenJPA, and if not is
>>>> there
>>>> a newer version of the mojo around anywhere?
>>>>
>>>> David
>>>>
>>>>
>>>>       
>>> --
>>> View this message in context:
>>> http://n2.nabble.com/maven-openjpa-plugin-problem-tp2311703p2311733.html
>>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>>>
>>>
>>>     
>>
>>   
> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/maven-openjpa-plugin-problem-tp2311703p2312884.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: maven-openjpa-plugin problem

Posted by Randy Watler <wa...@wispertel.net>.
Kevin/Rick/David:

I believe there is a simple way to upgrade the OpenJPA version for use 
with the Maven2 plugin. Try adding a plugin dependency for OpenJPA with 
your target version. It seems to work for us over here in the Jetspeed 
project. We're using OpenJPA 1.2.0. Of course, YMMV. Let me know if I 
can help or if you want me to paste an example pom.xml here.

Randy Watler

Kevin Sutter wrote:
> Is this worth "enhancing" (pardon the pun)?  Seriously, is this maven plugin
> worth supporting?  Or, possibly bringing into our svn?
>
> On Wed, Feb 11, 2009 at 4:08 PM, Rick Curtis <cu...@gmail.com> wrote:
>
>   
>> Dave -
>> I struggled with this very problem yesterday and never did get it to work
>> properly. I ended up using the ant-run plugin to invoke the OpenJPA
>> enhancer
>> task.
>>
>> Rick
>>
>>
>> David Goodenough-3 wrote:
>>     
>>> I am trying to the the OpenJPA plugin so that I can use the static
>>> enhancer as
>>> part of my Maven2 build.  But when I run it it seems to be drawing in
>>>       
>> very
>>     
>>> old
>>> versions of OpenJPA.
>>>
>>> Is this plugin useable with current versions of OpenJPA, and if not is
>>> there
>>> a newer version of the mojo around anywhere?
>>>
>>> David
>>>
>>>
>>>       
>> --
>> View this message in context:
>> http://n2.nabble.com/maven-openjpa-plugin-problem-tp2311703p2311733.html
>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>>
>>
>>     
>
>   


Re: maven-openjpa-plugin problem

Posted by David Goodenough <da...@btconnect.com>.
On Thursday 12 February 2009, Kevin Sutter wrote:
> David,
> I totally agree that enhancing the JPA POJOs is a desired operation.  I was
> referring to the maven plugin itself.  Is this tool worthwhile to support?
> It sounds like it could help the build time processing for OpenJPA
> enhancement.
>
> Kevin

It would certainly be useful to me, and by the sound of others on this thread
to them too, so yes please if you could find a way to either adopt it or 
persuade its authors to keep it up to date that would be great.

David
>
> On Thu, Feb 12, 2009 at 4:04 AM, David Goodenough <
>
> david.goodenough@btconnect.com> wrote:
> > On Wednesday 11 February 2009, Kevin Sutter wrote:
> > > Is this worth "enhancing" (pardon the pun)?  Seriously, is this maven
> > > plugin worth supporting?  Or, possibly bringing into our svn?
> >
> > Well yes there is a good reason to enhance.
> >
> > If you are using BeanBindings (and I guess that the other Bean Binding
> > machanisms have the same problem) it gets very confused if there are two
> > versions of the same class around, the one that is bound and the one that
> > gets delivered with the data.  The only way I found to get binding to
> > work correctly was to enhance the JPA POJOs.
> >
> > This has been discussed on several occasions on this forum (I initiated
> > one of the threads, and I was then pointed at other threads).
> >
> > David
> >
> > > On Wed, Feb 11, 2009 at 4:08 PM, Rick Curtis <cu...@gmail.com> wrote:
> > > > Dave -
> > > > I struggled with this very problem yesterday and never did get it to
> >
> > work
> >
> > > > properly. I ended up using the ant-run plugin to invoke the OpenJPA
> > > > enhancer
> > > > task.
> > > >
> > > > Rick
> > > >
> > > > David Goodenough-3 wrote:
> > > > > I am trying to the the OpenJPA plugin so that I can use the static
> > > > > enhancer as
> > > > > part of my Maven2 build.  But when I run it it seems to be drawing
> > > > > in
> > > >
> > > > very
> > > >
> > > > > old
> > > > > versions of OpenJPA.
> > > > >
> > > > > Is this plugin useable with current versions of OpenJPA, and if not
> >
> > is
> >
> > > > > there
> > > > > a newer version of the mojo around anywhere?
> > > > >
> > > > > David
> > > >
> > > > --
> > > > View this message in context:
> >
> > http://n2.nabble.com/maven-openjpa-plugin-problem-tp2311703p2311733.html
> >
> > > > Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: maven-openjpa-plugin problem

Posted by Adam Hardy <ad...@cyberspaceroad.com>.
Co-incidentally there was another thread on the same problem just a day or two 
back.

Here's the mojo code:

https://svn.codehaus.org/mojo/tags/openjpa-maven-plugin-1.0-alpha/src/main/java/org/codehaus/mojo/openjpa/OpenJpaEnhancerMojo.java

for me, the reason I don't use it is that the 'classes' property of the mojo 
only takes a single directory, and enhances all it can find in that dir.

I have 2 directories with different roots with entities in, and the root of both 
has too many other classes with dependencies that aren't involved with JPA.

I could have modified the mojo locally for my own purposes but I found it was 
easier to work out how to configure the maven-ant-run plugin than to build 
myself a maven plugin. Marginally I guess but I haven't done that before.

Regards
Adam




Kevin Sutter on 12/02/09 14:05, wrote:
> David,
> I totally agree that enhancing the JPA POJOs is a desired operation.  I was
> referring to the maven plugin itself.  Is this tool worthwhile to support?
> It sounds like it could help the build time processing for OpenJPA
> enhancement.
> 
> Kevin
> 
> On Thu, Feb 12, 2009 at 4:04 AM, David Goodenough <
> david.goodenough@btconnect.com> wrote:
> 
>> On Wednesday 11 February 2009, Kevin Sutter wrote:
>>> Is this worth "enhancing" (pardon the pun)?  Seriously, is this maven
>>> plugin worth supporting?  Or, possibly bringing into our svn?
>> Well yes there is a good reason to enhance.
>>
>> If you are using BeanBindings (and I guess that the other Bean Binding
>> machanisms have the same problem) it gets very confused if there are two
>> versions of the same class around, the one that is bound and the one that
>> gets delivered with the data.  The only way I found to get binding to work
>> correctly was to enhance the JPA POJOs.
>>
>> This has been discussed on several occasions on this forum (I initiated one
>> of the threads, and I was then pointed at other threads).


Re: maven-openjpa-plugin problem

Posted by Kevin Sutter <kw...@gmail.com>.
David,
I totally agree that enhancing the JPA POJOs is a desired operation.  I was
referring to the maven plugin itself.  Is this tool worthwhile to support?
It sounds like it could help the build time processing for OpenJPA
enhancement.

Kevin

On Thu, Feb 12, 2009 at 4:04 AM, David Goodenough <
david.goodenough@btconnect.com> wrote:

> On Wednesday 11 February 2009, Kevin Sutter wrote:
> > Is this worth "enhancing" (pardon the pun)?  Seriously, is this maven
> > plugin worth supporting?  Or, possibly bringing into our svn?
> Well yes there is a good reason to enhance.
>
> If you are using BeanBindings (and I guess that the other Bean Binding
> machanisms have the same problem) it gets very confused if there are two
> versions of the same class around, the one that is bound and the one that
> gets delivered with the data.  The only way I found to get binding to work
> correctly was to enhance the JPA POJOs.
>
> This has been discussed on several occasions on this forum (I initiated one
> of the threads, and I was then pointed at other threads).
>
> David
> >
> > On Wed, Feb 11, 2009 at 4:08 PM, Rick Curtis <cu...@gmail.com> wrote:
> > > Dave -
> > > I struggled with this very problem yesterday and never did get it to
> work
> > > properly. I ended up using the ant-run plugin to invoke the OpenJPA
> > > enhancer
> > > task.
> > >
> > > Rick
> > >
> > > David Goodenough-3 wrote:
> > > > I am trying to the the OpenJPA plugin so that I can use the static
> > > > enhancer as
> > > > part of my Maven2 build.  But when I run it it seems to be drawing in
> > >
> > > very
> > >
> > > > old
> > > > versions of OpenJPA.
> > > >
> > > > Is this plugin useable with current versions of OpenJPA, and if not
> is
> > > > there
> > > > a newer version of the mojo around anywhere?
> > > >
> > > > David
> > >
> > > --
> > > View this message in context:
> > >
> http://n2.nabble.com/maven-openjpa-plugin-problem-tp2311703p2311733.html
> > > Sent from the OpenJPA Users mailing list archive at Nabble.com.
>
>
>

Re: maven-openjpa-plugin problem

Posted by David Goodenough <da...@btconnect.com>.
On Wednesday 11 February 2009, Kevin Sutter wrote:
> Is this worth "enhancing" (pardon the pun)?  Seriously, is this maven
> plugin worth supporting?  Or, possibly bringing into our svn?
Well yes there is a good reason to enhance.

If you are using BeanBindings (and I guess that the other Bean Binding
machanisms have the same problem) it gets very confused if there are two
versions of the same class around, the one that is bound and the one that
gets delivered with the data.  The only way I found to get binding to work
correctly was to enhance the JPA POJOs.

This has been discussed on several occasions on this forum (I initiated one
of the threads, and I was then pointed at other threads).

David
>
> On Wed, Feb 11, 2009 at 4:08 PM, Rick Curtis <cu...@gmail.com> wrote:
> > Dave -
> > I struggled with this very problem yesterday and never did get it to work
> > properly. I ended up using the ant-run plugin to invoke the OpenJPA
> > enhancer
> > task.
> >
> > Rick
> >
> > David Goodenough-3 wrote:
> > > I am trying to the the OpenJPA plugin so that I can use the static
> > > enhancer as
> > > part of my Maven2 build.  But when I run it it seems to be drawing in
> >
> > very
> >
> > > old
> > > versions of OpenJPA.
> > >
> > > Is this plugin useable with current versions of OpenJPA, and if not is
> > > there
> > > a newer version of the mojo around anywhere?
> > >
> > > David
> >
> > --
> > View this message in context:
> > http://n2.nabble.com/maven-openjpa-plugin-problem-tp2311703p2311733.html
> > Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: maven-openjpa-plugin problem

Posted by Kevin Sutter <kw...@gmail.com>.
Is this worth "enhancing" (pardon the pun)?  Seriously, is this maven plugin
worth supporting?  Or, possibly bringing into our svn?

On Wed, Feb 11, 2009 at 4:08 PM, Rick Curtis <cu...@gmail.com> wrote:

>
> Dave -
> I struggled with this very problem yesterday and never did get it to work
> properly. I ended up using the ant-run plugin to invoke the OpenJPA
> enhancer
> task.
>
> Rick
>
>
> David Goodenough-3 wrote:
> >
> > I am trying to the the OpenJPA plugin so that I can use the static
> > enhancer as
> > part of my Maven2 build.  But when I run it it seems to be drawing in
> very
> > old
> > versions of OpenJPA.
> >
> > Is this plugin useable with current versions of OpenJPA, and if not is
> > there
> > a newer version of the mojo around anywhere?
> >
> > David
> >
> >
>
> --
> View this message in context:
> http://n2.nabble.com/maven-openjpa-plugin-problem-tp2311703p2311733.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>
>

Re: maven-openjpa-plugin problem

Posted by Rick Curtis <cu...@gmail.com>.
Dave -
I struggled with this very problem yesterday and never did get it to work
properly. I ended up using the ant-run plugin to invoke the OpenJPA enhancer
task. 

Rick


David Goodenough-3 wrote:
> 
> I am trying to the the OpenJPA plugin so that I can use the static
> enhancer as 
> part of my Maven2 build.  But when I run it it seems to be drawing in very
> old
> versions of OpenJPA.  
> 
> Is this plugin useable with current versions of OpenJPA, and if not is
> there
> a newer version of the mojo around anywhere?
> 
> David
> 
> 

-- 
View this message in context: http://n2.nabble.com/maven-openjpa-plugin-problem-tp2311703p2311733.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.