我尝试在Android Studio中设置jdo / jpa,然后回答上一个问题here的答案。
当我尝试运行增强任务时,我得到:
Error:Execution failed for task ':backend:appengineEnhance'.
An error occurred enhancing DataNucleus classes.
并且日志文件显示:
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:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
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
我认为上周在我的桌面上运行正常但是我试图在我的笔记本电脑上复制它并且似乎没有任何工作(克隆bitbucket存储库)。这是我的傻瓜:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.appengine:gradle-appengine-plugin:1.9.1'
}
}
repositories {
mavenCentral();
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'
sourceCompatibility = 1.7
targetCompatibility = 1.7
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.1'
compile 'com.google.appengine:appengine-endpoints:1.9.1'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.1'
compile 'javax.servlet:servlet-api:2.5'
// Persistence
compile 'org.ow2.asm:asm:4.0'
compile 'org.datanucleus:datanucleus-api-jpa:3.1.3'
compile 'org.datanucleus:datanucleus-api-jdo:3.1.3'
compile 'com.google.appengine.orm:datanucleus-appengine:2.1.2'
compile 'org.datanucleus:datanucleus-core:3.1.3'
compile 'org.apache.geronimo.specs:geronimo-jpa_2.0_spec:1.0'
compile 'javax.jdo:jdo-api:3.0.1'
compile 'javax.transaction:jta:1.1'
}
appengine {
downloadSdk = true
appcfg {
oauth2 = true
}
endpoints {
getClientLibsOnBuild = true
getDiscoveryDocsOnBuild = true
}
}
答案 0 :(得分:3)
对于@loosebazooka,答案是在上面的评论链接中使用v2增强器。
答案 1 :(得分:3)
我也遇到过这个问题 - 我的build.gradle的相关部分如下所示。请注意添加api =“jdo”,没有它我会继续得到与OP相同的错误。
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'
war.dependsOn appengineEnhance
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.14'
compile 'com.google.appengine:appengine-endpoints:1.9.14'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.14'
compile 'com.google.appengine.orm:datanucleus-appengine:2.1.2'
compile 'javax.servlet:servlet-api:2.5'
compile 'com.ganyo:gcm-server:1.0.2'
compile 'javax.jdo:jdo2-api:2.3-eb'
compile 'org.datanucleus:datanucleus-api-jdo:3.1.3'
}
appengine {
enhancer {
version = "v2"
api="jdo"
enhanceOnBuild = true
}
}