gradle-tomcat-plugin
gradle-tomcat-plugin copied to clipboard
Support for dynamically allocated stop port
trafficstars
We run integration tests on CI and using fixed ports is not an option because other services/tests may hold them.
Allocating a port up-front is not an option either, it could be taken by something else between the allocation time and it's effective usage.
Setting httpPort and httpsPort to 0 works, they get dynamically allocated and parsing info logs or tomcat logs allow to know which ports were choosen.
But it doesn't work for stopPort, here's the exception:
Caused by: java.lang.IllegalStateException: Bad stop port
at com.bmuschko.gradle.tomcat.internal.ShutdownMonitor.<init>(ShutdownMonitor.groovy:35)
at com.bmuschko.gradle.tomcat.tasks.AbstractTomcatRun.startTomcat(AbstractTomcatRun.groovy:363)
... 101 more
It would be nice if one could set stopPort to 0 so it's dynamically allocated.
I guess the complexity will be in getting tha dynamically allocated port and assign it to the corresponding stop task.