0

当我们开发 GAE java 后端时,我正在努力证明 gradle 和 gradle-gae-plugin 将为我们完成这项工作。

我取得了一些成功,但随后休了两个星期的假期,这当然应该受到惩罚......

现在我什至无法启动应用程序。所有依赖项似乎都是正确的,并且项目编译正常。

==================================================== =====================

引起:java.lang.ClassNotFoundException: com.google.appengine.api.LifecycleManager$ShutdownHook at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java: 355) 在 java.security.AccessController.doPrivileged(Native Method) 在 java.net.URLClassLoader.findClass(URLClassLoader.java:354) 在 java.lang.ClassLoader.loadClass(ClassLoader.java:423) 在 com.google.appengine .tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:214) 在 java.lang.ClassLoader.loadClass(ClassLoader.java:356) ... 30 更多 java.lang.NullPointerException 在 java.lang.Class.isAssignableFrom(Native方法)在 org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:256) 在 org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) 在 org.mortbay.jetty.ServletHandler.initialize(ServletHandler.java:685) 在 org.mortbay.jetty.servlet.Context.startContext(Context.java:140) 在 org.mortbay.jetty.webapp.WebAppContext .startContext(WebAppContext.java:1250) 在 org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517) 在 org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467) 在 org. mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)在 org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) 在 org.mortbay.jetty.Server.doStart(Server.java:224) 在 org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java :50) 在 com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:307) 在 com.google.appengine 的 com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:230) .tools.development.AutomaticServerInstanceHolder.startUp(AutomaticServerInstanceHolder.java:26) 在 com.google.appengine.tools.development.AbstractServer.startup(AbstractServer.java:80) 在 com.google.appengine.tools.development.Servers.startup (Servers.java:78) 在 com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:216) 在 com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:332 ) 在 com.google.appengine.tools 的 com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)。development.DevAppServerMain.(DevAppServerMain.java:268) 在 com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:244)

=================================

apply plugin: 'gae'
apply plugin: 'eclipse'

ext.version = "130"

buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
    }
    dependencies {
        classpath 'org.gradle.api.plugins:gradle-gae-plugin:0.8'
    }
}

repositories {
    mavenLocal()
    mavenCentral()
    maven {
        url "http://maven.kungfuters.org/content/groups/public/"        // javapns lives here!
    }
}

configurations {
    all*.exclude module: 'slf4j-log4j12'
}

dependencies {
    def gaeVersion = '1.7.7'
    def jerseyVersion = '1.17.1'

    gaeSdk "com.google.appengine:appengine-java-sdk:$gaeVersion"

    // compile fileTree(dir: 'war/WEB-INF/lib', includes: ['*.jar'])    // TODO: Change this in ze future!

    compile "javax.servlet:servlet-api:2.5"

    compile "commons-cli:commons-cli:1.2"
    compile "org.apache.commons:commons-lang3:3.1"
    compile "org.json:json:20090211"
    compile "javax.ws.rs:jsr311-api:1.1.1"

    compile "org.picocontainer:picocontainer:2.14.3"

    compile "com.google.appengine:appengine-api-1.0-sdk:$gaeVersion"
    compile "com.google.appengine:appengine-api-stubs:$gaeVersion"
    compile "com.google.appengine:appengine-remote-api:$gaeVersion"

    compile "com.google.appengine.tools:appengine-gcs-client:0.3"
    compile "com.google.appengine.tools:appengine-mapreduce:0.2"
    compile "com.google.appengine.tools:appengine-pipeline:0.1"


    compile "com.google.api-client:google-api-client:1.15.0-rc"
    compile "com.google.api-client:google-api-client-appengine:1.15.0-rc"
    compile "com.google.api.client:google-api-client-json:1.2.3-alpha"
    compile "com.google.apis:google-api-services-bigquery:v2-rev97-1.15.0-rc"
    compile "com.google.apis:google-api-services-storage:v1beta2-rev10-1.15.0-rc"
    compile "com.google.http-client:google-http-client:1.15.0-rc"
    compile "com.google.http-client:google-http-client-jackson:1.15.0-rc"

    compile "com.googlecode.javapns:javapns:2.2"

    compile "com.sun.jersey:jersey-core:$jerseyVersion" 
    compile "com.sun.jersey:jersey-server:$jerseyVersion"   
    compile "com.sun.jersey:jersey-servlet:$jerseyVersion" 
    compile "com.sun.jersey:jersey-client:$jerseyVersion"   
    compile "com.sun.jersey:jersey-json:$jerseyVersion"

    compile "org.bouncycastle:bcprov-jdk15on:1.48"

    runtime "org.slf4j:slf4j-jdk14:1.7.5"

    testCompile "junit:junit:4.10"
    testCompile "org.mockito:mockito-all:1.9.0"
    testCompile "com.google.appengine:appengine-testing:$gaeVersion"
}


sourceSets {
    main { java {srcDir 'src' } }
    test { java {srcDir 'testsrc' } }
}

test {
  // set heap size for the test JVM(s)
  minHeapSize = "128m"
  maxHeapSize = "512m"

  // set JVM arguments for the test JVM(s)
  jvmArgs '-XX:MaxPermSize=768m'

  // listen to events in the test execution lifecycle
  beforeTest { descriptor ->
     logger.lifecycle("Running: " + descriptor)
  }
} 

webAppDirName = file('war') 

gae {
    httpPort = 8888
    jvmFlags = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8889', '-Xmx1024m', '-XX:MaxPermSize=512m']
    downloadSdk = true
    warDir = file('war')

    appcfg {
        update {
         useJava7 = true
        }

        email = 'foo@bar.se'
        passIn = true

        logs {
            severity = 1
            numDays = 1
            outputFile = file('dalby.log')
        }

        app {
            id = 'dalby-gunnar'
        }
    }
}

eclipse {
    classpath {
       downloadSources=true
    }
}
4

1 回答 1

0

听起来您必须告诉 Java 编译器(我假设您的代码是用 Java 编写的)来设置注释处理。根据我在错误消息中看到的内容,我将尝试以下操作:

禁用注释处理

compileJava.options.compilerArgs = ['-proc:none']

启用注释处理

compileJava.options.compilerArgs = ['-implicit']
于 2013-07-16T10:45:47.000 回答