我正在尝试构建我的第一个 Google App Engine WAR,并正在设置我自己的外部(Eclipse 之外)Ant 构建以从终端执行。我正在尝试让<enhance_war/>
Ant 宏工作并且遇到了一个奇怪的NoSuchMethodError
.
这是我的 Ant 目标:
<target name="package" depends="gendocs">
<echo message="Enhancing WAR JDO classes." />
<enhance_war war="war" />
<echo message="Packaging the WAR file." />
<war destfile="gen/dist/myapp.war" webxml="war/web.xml">
<fileset dir="war">
<includes name="**/*.xml" />
</fileset>
<lib dir="war/WEB-INF/lib" />
<classes dir="war/WEB-INF/classes" />
</war>
</target>
这是 Ant 尝试执行package
目标时的输出:
package:
[echo] Enhancing WAR JDO classes.
[enhance] Encountered a problem: Unexpected exception
[enhance] Please see the logs [/tmp/enhance4426322586552955387.log] for further information.
BUILD FAILED
/home/myuser/sandbox/workbench/eclipse/workspace/myapp/build/build-local.xml:193: The following error occurred while executing this line:
/home/myuser/sandbox/workbench/google/gae-sdk/1.7.1/appengine-java-sdk-1.7.1/config/user/ant-macros.xml:95: Java returned: 1
这ant-macros.xml:95
对应于以下行:
<enhance failonerror="true" api="@{api}">
<!-- Rest of the enhance task def -->
</enhance>
所以在执行这个<enhance />
任务时出了点问题,但我不知道是什么。
最后是日志文件/tmp/enhance4426322586552955387.log
:
java.lang.RuntimeException: Unexpected exception
at com.google.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:76)
at com.google.appengine.tools.enhancer.Enhance.<init>(Enhance.java:71)
at com.google.appengine.tools.enhancer.Enhance.main(Enhance.java:51)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:74)
... 2 more
Caused by: java.lang.NoSuchMethodError: org.datanucleus.plugin.PluginManager.<init>(Lorg/datanucleus/PersistenceConfiguration;Lorg/datanucleus/ClassLoaderResolver;)V
at org.datanucleus.OMFContext.<init>(OMFContext.java:159)
at org.datanucleus.enhancer.DataNucleusEnhancer.<init>(DataNucleusEnhancer.java:172)
at org.datanucleus.enhancer.DataNucleusEnhancer.<init>(DataNucleusEnhancer.java:150)
at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1157)
... 7 more
这里发生了什么?我不认为这是一个类路径问题,因为org.datanucleus.plugin.PluginManager
该类是在内部定义的datanucleus-core-1.1.5.jar
,我在构建类路径中绝对有。加上它NoSuchMethodError
,所以它让我觉得我有一个 JAR 地狱/版本控制问题。有任何想法吗?