Currently, the Jetty and Tomcat plugins only allow stopping/starting via tasks. This is limiting, and makes things like integration testing a deployed app cumbersome.
A better approach would be offer imperative and declarative interfaces. An example of this approach would be the ‘Copy’, ‘Exec’ and ‘JavaExec’ etc. tasks. This provides more control and flexible. In this case, the tasks are just for adapting the functionality to the task execution mechanism. This is a good general pattern.