本文介绍了怎么办OpenJPA的增强与ANT + IntelliJ IDEA的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是快把我逼疯了,我很震惊,是绝对useles。

下面是我:


  • IntelliJ IDEA的11

  • OpenJPA的2.1.1

由于OpenJPA的加入到使用的库列表中我已经有classpath中到OpenJPA它看起来像这样

 <路径ID =library.openjpa.classpath>
    <文件集DIR =$ {} BASEDIR / lib目录/ OpenJPA的>
        < patternset REFID =library.patterns/>
    < /文件集>
< /路径>

根据官方文档,我添加以下目标

 <目标名称=提升>
    <复制includeemptydirs =假todir =$ {} BASEDIR / lib目录/ OpenJPA的>
        <文件集DIR =SRC排除=** / *的推出,** / * java的。/>
    < /复制>    <的taskdef NAME =openjpac类名=org.apache.openjpa.ant.PCEnhancerTask>
        <类路径REFID =library.openjpa.classpath/>
    < /&的taskdef GT;    < openjpac>
        <类路径REFID =library.openjpa.classpath/>
    < / openjpac>
< /目标与GT;

这让我异常

I tested with Process Monitor and can see that it opens and reads persistence.xml.

Some person filed bug having problems I have and the answer he got was that finding persistence.xml is not a source of problem.

Questions are:

  1. What can I do to make it work ?
  2. Can I make it work by skipping need for persistence.xml and just specifying pattern for .class files I want to be enhanced ?
  3. It's more Ant question. How can I make OpenJPA enhancer to look for persistence.xml in directory other than where openjpa-2.1.1.jar resides ?
解决方案

So I couldn't make it work without undocumented propertiesFile. Here is version that works for me. Also specifying persistence-unit via # makes it fail with NullReferenceException.

<target name="enhance">
    <taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask">
        <classpath refid="library.openjpa.classpath"/>
    </taskdef>

    <openjpac>
        <classpath refid="library.openjpa.classpath"/>
        <classpath location="${reporting.output.dir}"/>
        <config propertiesFile = "${basedir}/src/META-INF/persistence.xml"/>
    </openjpac>
</target>

这篇关于怎么办OpenJPA的增强与ANT + IntelliJ IDEA的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-20 03:18