0

My question

I am porting my application from version 1.x to 2.0 of the DataNucleus plug-in for GAE/J using the new 1.7.5 GAE/J SDK, but I am unable to use the arguments -enhancerVersion and v2 successfully. (Is the default target without these arguments version 1 of the DataNucleus GAE/J plug-in, which I do not want?)

Does anyone know how I could specify these arguments successfully?

My software environment

  • Web framework: Apache Wicket 6.5.0
  • Web server: Google App Engine for Java version 1.7.5
  • Java version: 1.6.0_39; Java HotSpot(TM) Client VM 20.14-b01
  • IDE: NetBeans 7.2 (build 201207171143)
  • GAE/J DataNucleus plug-in version: 2.1.2
  • DataNucleus Access Platform version: 3.1.3
  • Operating system: Microsoft Windows XP version 5.1 running on x86

Background information and build failure log output

The GAE/J documentation at

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

says:

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>

My code in my NetBeans build.xml is slightly different:

<!--  *******************************************************************  -->
<!--  **                                                                   -->
<!--  **  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>

The build process failed with output:

...

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)
4

1 回答 1

1

The (official) DataNucleus enhancer Ant task (seen here) has no such args as input. Those args are Google's own stuff (whatever the "enhance_war" thing refers to). All DataNucleus enhancer cares about is having the relevant jars in the CLASSPATH and is configurable as per this.

于 2013-02-16T08:44:30.973 回答