Choosing specific ports on local development server for non-default modules

587 views Asked by At

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 = "[email protected]"
        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)
1

There are 1 answers

0
yaraju On BEST ANSWER

@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 = "[email protected]"
        oauth2 = true
    }
}