GoogleCloudPlatform / app-gradle-plugin

The library has moved to https://github.com/GoogleCloudPlatform/appengine-plugins/tree/main/app-gradle-plugin
Apache License 2.0
153 stars 40 forks source link

Problem with migrating to this plugin #80

Closed oakstair closed 7 years ago

oakstair commented 8 years ago

We have been using the the gradle-appengine-plugin for a while now but since this is the future we decided to give it a try.

We get this however ....

€ gradle -bbuild2.gradle appRun

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/gunnar/repos/sportsbillionairebackend/server/build2.gradle' line: 208

* What went wrong:
A problem occurred evaluating root project 'server'.
> Could not find method run() for arguments     [build2_apwpxqz9l8zq7g95kjcnxps6f$_run_closure6$_closure27@256027fa] on object of type com.google.cloud.tools.gradle.appengine.model.AppEngineFlexibleExtension.

Must be something we have missed!

And here is the build script.

apply plugin: 'java'
apply plugin: 'war'
apply plugin: "com.google.cloud.tools.appengine"

allprojects  {
    ext {

       Properties props = new Properties()
        props.load(new FileInputStream("build.properties"))
        props.each { prop ->
            project.ext.set(prop.key, prop.value)
        }
        appName = 'sbb'
    }
}

project.ext {
    gbqVersion      = 'v2-rev286-1.21.0'
    tapestryVersion = '5.4.0'
    jerseyVersion   = '1.19.1'
}

buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.google.cloud.tools:appengine-gradle-plugin:+'
    classpath "com.google.protobuf:protobuf-gradle-plugin:0.7.6"
     }
}

repositories {
  maven {
    url 'https://maven-central.storage.googleapis.com' 
  }
  jcenter()
  mavenCentral()
}

compileJava.options.encoding = 'UTF-8'

dependencies {
    providedCompile group: 'javax.servlet', name: 'servlet-api', version:'2.5'
    compile 'com.google.appengine:appengine:+'

       // appengineSdk "com.google.appengine:appengine-java-sdk:${gaeVersion}"

        // compile "javax.servlet:servlet-api:2.5"
        compile "javax.inject:javax.inject:1"

    compile 'org.projectlombok:lombok:1.16.6'

        compile "jstl:jstl:1.2"

        compile "com.google.appengine:appengine-remote-api:$gaeVersion"
        compile "com.google.appengine:appengine-api-labs:${gaeVersion}"

        compile "com.google.apis:google-api-services-bigquery:$gbqVersion"
        compile "com.google.appengine.tools:appengine-gcs-client:0.5"

        compile "com.googlecode.objectify:objectify:5.1.13"

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

        compile "com.restfb:restfb:1.9.0"

        compile "com.google.code.gson:gson:2.3.1"
        compile "org.picocontainer:picocontainer:2.15"

    compile "net.sourceforge.javacsv:javacsv:2.0"
    compile "com.google.code.gson:gson:2.5"
    compile 'com.google.maps:google-maps-services:0.1.9'
    compile 'com.google.gdata:core:1.47.1'
    compile "com.google.http-client:google-http-client:1.21.0"

    compile "org.slf4j:slf4j-api:1.7.10"
    compile "org.slf4j:slf4j-jdk14:1.7.10"

        compile("org.apache.tapestry:tapestry-ioc:$tapestryVersion") {
        exclude module: 'slf4j-log4j12'
        exclude module: 'log4j'
    }
    compile("org.apache.tapestry:tapestry-core:$tapestryVersion") {
        exclude module: 'slf4j-log4j12'
        exclude module: 'log4j'
    }

    compile 'com.pubnub:pubnub:3.6.3'

    testCompile "junit:junit:4.12"
    testCompile "org.mockito:mockito-all:1.10.19"
    testCompile "com.google.appengine:appengine-testing:$gaeVersion"
    testCompile "com.google.appengine:appengine-api-stubs:$gaeVersion"
}

war {
    inputs.property 'gaeApp', gaeApp
        inputs.property 'gaeAppVersion', gaeAppVersion
    with copySpec {
        from 'src/template/webapp' 
        expand gaeApp: gaeApp, gaeAppVersion: gaeAppVersion
    } 
}

appengine {

    run {
        port = 8888
    }

    deploy {
        stopPreviousVersion = true  // default - stop the current version
        promote = true              // default - & make this the current version
    }

}

group = 'com.example.appengine'   // Generated output GroupId
version = '1.0-SNAPSHOT'          // Version in generated output

eclipse {
    project {
        name = appName + "-server"
    }

    classpath {
       downloadSources=true
    }

}
patflynn commented 7 years ago

@loosebazooka

loosebazooka commented 7 years ago

This appears like it could be because it's not autodetecting that it's a standard project. Do you have an appengine-web.xml in src/main/webapp/WEB-INF ?

loosebazooka commented 7 years ago

@oakstair if you were still unable to migrate, please re-open this with more details.

yuri-sergiichuk commented 7 years ago

@loosebazooka is there any way to tell the plugin that it's standard project without auto-detecting the appengine-web.xml? The reason for that is cause I use copy tasks to copy appengine configuration depending on the environment it'd work on, but, for example, when I run gradlew clean there is nothing copied yet (it'll be copied during the build phase), so plugin crashes with such an exception:

Could not find method run() for arguments [build_5z5bk6tp5bqdnghwe3oebqvov$_run_closure2$_closure3@3fac8ed] on object of type com.google.cloud.tools.gradle.appengine.core.AppEngineExtension.

Could you please advice how could the plugin configuration be tweaked?

Regards, Yuri.