GWT Gradle plugin: changing port? Tomcat vs Jetty?

558 views
Skip to first unread message

Thad Humphries

unread,
May 9, 2014, 4:14:38 PM5/9/14
to google-we...@googlegroups.com
I'm trying out Gradle, the gwt-gradle-plugin, and Super Dev Mode. I've got the plugin (https://github.com/steffenschaefer/gwt-gradle-plugin) and am trying to run the super-dev-mode example. Since Tomcat is already running on my workstation, I want to change the Jetty port from 8080 to 8888. However although I set "cargo { port = 8888...", I still get

    :jettyDraftWar
    failed SelectChann...@0.0.0.0:8080: java.net.BindException: Address already in use

when I run `gradle jettyDraftWar`. If I run `gradle cargoRunLocal`, things are fine and I can run my app, but I suspect that's not doing everything the gwt-gradle-plugin intends, and I want to get off on the right foot (vs my initial bumbling around with Maven and SDM).

Is this a bug or should I be setting httpPort somewhere? I've tried several places. Jetty opens 8888 but the app cannot be found.

Also, I can get my app running with Tomcat using tomcatRunWar (with alternate port and ajp.port), but I'm not finding the magic to do this via the gwt-gradle-plugin. Can anyone help?

Jens

unread,
May 9, 2014, 5:56:15 PM5/9/14
to google-we...@googlegroups.com
If you run jettyDraftWar which is probably of type JettyRunWar you must configure the jetty plugin. If you run cargo then you must configure jetty through the cargo plugin.

For the cargo plugin you configure the port using cargo { port = 8888 ... } and for the jetty plugin you configure the port using "jettyRun.httpPort = 8888" or "jettyRun { httpPort = 8888 }".

In general you are not forced to use both Jetty plugin and cargo plugin. I guess the SDM example just wants to show that both is possible. Also I think that the gwt-gradle-plugin does no additional magic behind the scenes when running jetty or tomcat or anything else to serve your app. The gwt-gradle-plugin only starts SDM and thats all. 

How you serve your app and which plugin you choose to do so is up to you.


Thad Humphries

unread,
May 10, 2014, 12:04:00 PM5/10/14
to google-we...@googlegroups.com
Thank you. I appreciate the time that you and others put into this group (and GWT in general).

It took some more bumbling around, but I found it worked with two additions (highlighted below):

...
cargo {
  containerId = 'jetty9x'
  port = 8888

  deployable {
    file = tasks.draftWar.archivePath
    context = 'app'
  }

  local {
    installer {
            installUrl = file("$projectDir/etc/jetty-distribution-9.0.5.v20130815.zip").toURI()
            downloadDir = file("$buildDir/download")
            extractDir = file("$buildDir/extract")
        }
  }
}
  
task jettyDraftWar(type: JettyRunWar) {
  dependsOn draftWar
  dependsOn.remove('war')
  webApp=draftWar.archivePath
  httpPort = 8888
  contextPath = 'app'
}
...

This being Gradle, there are probably three other ways I could have done it, but it took me enough tries to find this one. :-/

That accomplished, if it makes no difference from the server side, I may just stick with Cargo. We'll see when it comes to Eclipse and servlet debugging.

I must say that while I can see how useful Gradle might be--assembling a GWT app, Javadocs, server apps, etc. can be difficult--learning Gradle is no small task. After a day walking through the exercises in Maven by Example I understood it well enough to start converting my project, from base libraries on through to the final distro. I've been banging away at the Gradle User's Guide and Ikkink's Gradle Effective Implementation Guide for a while now and still feel overwhelmed. 

Coming soon--mgwt 2.0, Elemental, Java8 Lambdas, GWT 3.0... Some day I really hope to have the time to read fiction again.
Reply all
Reply to author
Forward
0 new messages