tags:

views:

839

answers:

4

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

+2  A: 

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

Diego Dias
I don't see how this answer solves the **remote** part...
Pascal Thivent
just see the links and you will understand.
Diego Dias
There is **nothing** about starting/stopping a remote tomcat in the links.
Pascal Thivent
+1  A: 

Try this useful Plugin

Afterwards try this:

mvn tomcat:start

and

mvn tomcat:stop
bastianneu
This won't start/stop a **remote** tomcat
Pascal Thivent
+2  A: 

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.

Pascal Thivent
+1  A: 

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!

Wanderson Santos
You can easily do SCP and SSH with ANT. Just use SCP and SSHExec tasks, and be happy!
Wanderson Santos
Just in time: http://wiki.apache.org/ant/NewAntFeaturesInDetail/Ssh
Wanderson Santos