开发者

start/stop tomcat using maven

How can i start/stop remote tomcat using maven. I am using cargo plugin which helps me in deploying t开发者_JAVA技巧he application , but doesn't provides the functionality to start/stop the remote tomcat.


Indeed, You can NOT start and stop Tomcat running remotely using Cargo, only deploy and undeploy your web application.

Actually, to my knowledge, there is currently nothing allowing to do this out of the box.

As explained here, the only way to make server "A" start or stop a service like Tomcat when the request comes from client "B" is that yet-another service needs to be available and already running on server "A". [...] and I don't know if such a service is available.

In this message, someone is describing such a solution (based on a socket listener) that you could maybe use (by doing some telnet through maven) but the message is quite old so it's likely outdated and the link pointing to the code seems to be dead. I didn't check out the whole thread, maybe there are other ideas.

If you are using windows, remote service sharing is another possible solution as described here. But, again, this would require some work on your side.


From a security standpoint, it's only possible in this way...

Linux: use an SCP or script via SSH Client (putty), then '$CATALINA_HOME/bin/shutdown.sh'

Windows: use sc command, like "sc \192.168.10.10 stop tomcat6"

Quick and clean!


You can try to use the maven tomcat plugin or if it does not give you everything you need, you can always use an ant task here is a reference on the task


You can use Cargo Daemon web-application. It runs on the remote machine and can start/stop tomcat for you (as well as deploy an app). You just need to configure Cargo plugin and call mvn:daemon-start. Here is the link: http://cargo.codehaus.org/Cargo+Daemon. It's easier to start with provided Cargo Daemon archetype: http://cargo.codehaus.org/Maven2+Archetypes#Maven2Archetypes-daemon


Try this useful Plugin

Afterwards try this:

mvn tomcat:start

and

mvn tomcat:stop
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜