如何连接到远程服务器并使用Ant启动/停止在该特定服务器上运行的Tomcat?

目的是:

1: connect to a remote server maybe via host: ip , port: 8181 2: stop Tomcat that's running on that server 3: deploy a .war file 4: restart tomcat 

我相信监控和管理Tomcat下的Tomcat文档提供了一些有关如何停止给定应用程序但不完全是服务器的信息:

  

如果您具有对服务器的ssh访问权限,那么您可能想要考虑可以与SSHExec Ant Task结合使用的JSch库来启动和停止服务器: