Why can't I shutdown tomcat 7 embedded from maven plugin?

人走茶凉 提交于 2019-12-01 18:13:14

As far as I know you need to use Ctrl + c after starting Tomcat server with mvn tomcat7:run to shut it down as it's attached to the current Maven run.

The shutdown goal is used to be called after e.g. performing some tests (integration tests) to finish all the job in a clean way.

have a look at the fork option http://tomcat.apache.org/maven-plugin-2.2/tomcat7-maven-plugin/run-mojo.html#fork

So with this option you are able to start embeded tomcat run some tests then shutdown.

HTH

An alternative is if the Tomcat maven plugin had a way to enable the shutdown port (default 8005) then you can just send the default shutdown string (default "shutdown") to shut it down.

Using a JMX client, the shutdown port is set to -1 when I run the plugin run goal.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!