4

In my build.gradle file, I use the following config for my non-default (module2) AppEngine gradle module:

appengine {
    downloadSdk = true
    httpAddress = "0.0.0.0"
    httpPort = 8081
    appcfg {
        email = "blahemail@domain.com"
        oauth2 = true
    }
}

However, when I run my "Google AppEngine configuration", the module still starts on some_random_port instead of on 8081. I want to fix the ports that these run on, so I can rely on those ports when I run test requests on my local development server.

What am I doing wrong? Or is this just not supported?

====================================================================== Appengine modules structure:

- root( apply java, ear, appengine)
  - default (apply java, war, appengine) - needs to run on 8080 on local dev server
  - module2 (apply java, war, appengine) - needs to run on 8081 on local dev server

Appengine version: 1.9.22

Gradle Appengine plugin version: 1.9.21

EDIT:

I also tried running each module in its own "Appengine run configuation" and while the modules do run in their respective ports, I can no longer communicate between them. Trying to schedule a task on module2 from a servlet on default module gives the following error:

com.google.appengine.api.modules.ModulesException: Unknown module
    at com.google.appengine.api.modules.ModulesServiceImpl$ModulesServiceFutureWrapper.convertApplicationException(ModulesServiceImpl.java:365)
    at com.google.appengine.api.modules.ModulesServiceImpl$ModulesServiceFutureWrapper.convertException(ModulesServiceImpl.java:352)
    at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:96)
    at com.google.appengine.api.modules.ModulesServiceImpl.getAsyncResult(ModulesServiceImpl.java:104)
    at com.google.appengine.api.modules.ModulesServiceImpl.getDefaultVersion(ModulesServiceImpl.java:163)
yaraju
  • 547
  • 3
  • 18
  • First thought: try to upgrade your version of the SDK? 1.9.15 was the release on November 3rd last year, so that might be involved. In addition, the Gradle plugin is in version 1.9.21, so try to update that as well. – Nick Jun 12 '15 at 20:28
  • @Nick Good suggestion. However, I just upgraded both and still see the same behavior. (Updated my post with the new versions I'm using) – yaraju Jun 13 '15 at 05:54
  • 1
    I don't know anything about gradle, but it is supported in maven. you need to be launching the ear and setting jvm flags. Here's a maven snippet: `-Dcom.google.appengine.devappserver_module.module1.port=8081 -Dcom.google.appengine.devappserver_module.module2.port=8082` – crazystick Jun 14 '15 at 18:17
  • @crazystick Thanks a bunch! That did the job! Added the gradle-version answer below. – yaraju Jun 15 '15 at 09:21

1 Answers1

3

@crazystick answered it for Maven. Here's the same solution re-done for Gradle:

apply plugin: ear

...

appengine {
    downloadSdk = true
    httpAddress = "0.0.0.0"
    jvmFlags = ['-Dcom.google.appengine.devappserver_module.default.port=8080',
                '-Dcom.google.appengine.devappserver_module.module1.port=8081']
    appcfg {
        email = "blahemail@domain.com"
        oauth2 = true
    }
}
yaraju
  • 547
  • 3
  • 18