【问题标题】:Unable to enhance byte code to JDO 3.0 using version 2 of the DataNucleus GAE/J plug-in无法使用 DataNucleus GAE/J 插件版本 2 将字节码增强到 JDO 3.0
【发布时间】:2013-02-15 19:44:00
【问题描述】:

我的问题

我正在使用新的 1.7.5 GAE/J SDK 将我的应用程序从版本 1.x 移植到 GAE/J 的 DataNucleus 插件 2.0,但我无法使用参数 -enhancerVersion 和 @987654323 @ 成功地。 (不带这些参数的默认目标是不是我不想要的 DataNucleus GAE/J 插件版本 1?)

有谁知道我怎样才能成功地指定这些参数?

我的软件环境

  • Web 框架:Apache Wicket 6.5.0
  • Web 服务器:Google App Engine for Java 1.7.5 版
  • Java 版本:1.6.0_39; Java HotSpot(TM) 客户端虚拟机 20.14-b01
  • IDE:NetBeans 7.2(内部版本 201207171143)
  • GAE/J DataNucleus 插件版本:2.1.2
  • DataNucleus 访问平台版本: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)

【问题讨论】:

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


    【解决方案1】:

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

    【讨论】:

    • 谢谢,安迪。 (我只能猜测 GAE/J 记录的“enhance_war”可能是随 Eclipse 插件提供的,我不使用它。)
    猜你喜欢
    • 2013-02-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-16
    • 2013-10-04
    • 1970-01-01
    • 1970-01-01
    • 2012-09-30
    相关资源
    最近更新 更多