I'm running through a tutorial from http://spring.io about RESTful webservices.
I wanted to be able to launch my web project from Eclipse as a Gradle build (Run As => Gradle Build...) and then stop it when I'm done testing it.
I know how to start it, but I just can't get it to stop without quitting Eclipse (Spring Tool Suite).
Any Suggestions?
To borrow from the Gradle Tomcat plugin documentation, just do this:
ext {
tomcatStopPort = 8081
tomcatStopKey = 'stopKey'
}
task doTomcatRun(type: org.gradle.api.plugins.tomcat.TomcatRun) {
stopPort = tomcatStopPort
stopKey = tomcatStopKey
daemon = true
}
task doTomcatStop(type: org.gradle.api.plugins.tomcat.TomcatStop) {
stopPort = tomcatStopPort
stopKey = tomcatStopKey
}
task someTask(type: SomeGradleTaskType) {
//do stuff
dependsOn doTomcatRun
finalizedBy doTomcatStop
}
In this example, someTask
is a Gradle task that you execute where Tomcat is started before the task runs and Tomcat is stopped after the task completes.
If you prefer something more manual, then simply configure and then run the tomcatStop
task via Eclipse:
tomcatStop {
stopPort = 8090
stopKey = 'foo'
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With