无法使用DataNucleus GAE / J插件的版本2将字节代码增强到JDO 3.0

时间:2013-02-15 19:44:01

标签: java google-app-engine ant wicket datanucleus

我的问题

我使用新的1.7.5 GAE / J SDK将我的应用程序从1.x版移植到GAE / J的DataNucleus插件的2.0版本,但是我无法使用参数-enhancerVersionv2成功了。 (没有这些参数的默认目标是DataNucleus GAE / J插件的版本1,我不想要它吗?)

有谁知道如何成功指定这些参数?

我的软件环境

  • Web框架:Apache Wicket 6.5.0
  • 网络服务器:Google App Engine for Java 1.7.5版
  • Java版本:1.6.0_39; Java HotSpot(TM)客户端VM 20.14-b01
  • IDE:NetBeans 7.2(内部版本201207171143)
  • GAE / J DataNucleus插件版本:2.1.2
  • DataNucleus Access Platform版本:3.1.3
  • 操作系统:在x86上运行的Microsoft Windows XP 5.1版

背景信息和构建失败日志输出

上的GAE / J文档

Google App Engine | Java | Storing Data | JDO | Overview JDO (3.0) | Migrating to Version 2.x of the DataNucleus Plugin | Changes to Configuration Files

表示:

In build.xml

...

2.  The datanucleusenhance target has changed. Update this section:

<target name="datanucleusenhance" depends="compile"
 description="Performs enhancement on compiled data classes.">
<enhance_war war="war" />
</target>

to:

<target name="datanucleusenhance" depends="compile"
 description="Performs enhancement on compiled data classes.">
<enhance_war war="war">
  <args>
    <arg value="-enhancerVersion"/>
    <arg value="v2"/>
  </args>
</enhance_war>
</target>

我的NetBeans build.xml中的代码略有不同:

<!--  *******************************************************************  -->
<!--  **                                                                   -->
<!--  **  This block extends the original "-post-compile" target in        -->
<!--  **  "nbproject/build-impl.xml" by adding "depends" and "description" -->
<!--  **  attributes and implementing them.                                -->
<!--  **                                                                   -->

<target
 name="-post-compile"
 depends="datanucleusenhancer"
 description="Called after javac compilation (DataNucleus enhancement)"
/>

...

<target
 name="datanucleusenhancer"
 description="Performs the DataNucleus post-compilation enhancement"
>
  <taskdef
   name="datanucleusenhancertask"
   classpathref="datanucleus.enhancer.classpath"
   classname="org.datanucleus.enhancer.tools.EnhancerTask"
  />

  <datanucleusenhancertask
   dir="${build.classes.dir}"
   classpathref="datanucleus.enhancer.classpath"
   api="JDO"
   failonerror="true"
   verbose="true"
   filesuffixes="class"
   >
    <fileset dir="${build.classes.dir}" casesensitive="false">
      <filename name="**/persistence/**"/>
    </fileset>
    <jvmarg line="-Dlog4j.configuration=file:nbproject/log4j.properties"/>
    <args>                               <!--  Added   -->
      <arg value="-enhancerVersion"/>    <!--  code    -->
      <arg value="v2"/>                  <!--  to set  -->
    </args>                              <!--  args    -->
  </datanucleusenhancertask>
</target>

构建过程因输出失败:

...

datanucleusenhancer:
Enhancer api: JDO
Enhancer verbose: true
C:\...\build.xml:154: datanucleusenhancertask doesn't support the nested "args" element.
  at org.apache.tools.ant.UnknownElement.handleChildren(UnknownElement.java:362)
  at org.apache.tools.ant.UnknownElement.configure(UnknownElement.java:201)
  at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:163)
  at org.apache.tools.ant.Task.perform(Task.java:347)
  at org.apache.tools.ant.Target.execute(Target.java:392)
  at org.apache.tools.ant.Target.performTasks(Target.java:413)
  at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
  at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
  at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
  at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
  at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:283)
  at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:541)
  at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
Caused by: The <datanucleusenhancertask> type doesn't support the nested "args" element.
  at org.apache.tools.ant.IntrospectionHelper.throwNotSupported(IntrospectionHelper.java:503)
  at org.apache.tools.ant.UnknownElement.handleChildren(UnknownElement.java:352)
  ... 12 more
BUILD FAILED (total time: 44 seconds)

1 个答案:

答案 0 :(得分:1)

(官方)DataNucleus增强器Ant任务(seen here)没有输入这样的args。那些args是Google自己的东西(无论“enhance_war”指的是什么)。所有DataNucleus增强器都关心的是在CLASSPATH中拥有相关的jar,并且可以按this进行配置。