grails-plugins/grails-tomcat-plugin — pull request #6 by johnrengelman (2013-10-17 18:35:26+00:00)
Title: Enable support for random port assignment

:warning: Looking for some feedback on the content of this pull request before it is merged. Specifically in how the 'killSwitch' port is being determined.

The issue is that if a user sets both http and https ports to be 0, then they will be assigned sequential ports by the OS (most likely) - for example `grails run-app -Dserver.port=0 -Dserver.port.https=0` results in Grails binding HTTP to 54376 and HTTPS to 54377. This stops the kill switch thread from binding to the HTTP port + 1.
To handle this and provide for backwards compatibility, I've only enabled the ability to assign the ports to 0 starting with Grails 2.3.2 and beyond (use the buildSettings.grailsVersion to figure that out). Otherwise, the plugin will behave as it originally did (assigning -Dserver.port=0 results in using the DEFAULT_PORT, 8080)

These changes will also require some small changes to Grails-Core. I've got this ready as well.