sbtxsbt-web-plugin

xsbt-web-plugin how to stop container without killing sbt console


I am using xsbt-web-plugin v4.0.1. After starting the sbt console, the tomcat:start command works fine. However I don't know how to run tomcat:stop. When I press Ctrl-C, I exit out of console, but I think tomcat continues to run in background. When I press Ctrl-D, I see the message waiting for server to shutdown and then sbt exists. Either case, I am forced to start sbt console again.

I have added following 2 lines in build.sbt

fork in run := true
connectInput in run := true

and this line in my global.sbt

cancelable in Global := true

How can I start and stop container without exiting sbt?


Solution

  • After running tomcat:start, you can run tomcat:stop (or any other sbt command) at any time.

    The tomcat:start command does not block further interaction with the sbt prompt. It can be misleading to see the output of the container mixed in with that of the sbt prompt.

    The fork in run, connectInput in run, and cancelable in Global settings are not needed to be able to use tomcat:start and tomcat:stop.