目的是:

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 DocumentationMonitoring and Managing Tomcat 下提供了一些关于如何停止给定应用程序的信息,但不是完全停止服务器:

<jmx:invoke 
    name="Catalina:type=Manager,path=/servlets-examples,host=localhost"  
    operation="stop"/> 

如果您可以通过 ssh 访问服务器,那么您可能会考虑 JSch library您可以将其与 SSHExec Ant Task 结合使用启动和停止您的服务器:

<sshexec host="somehost" 
    username="dude" 
    password="yo" 
    command="/etc/init.d/tomcat restart"/> 


评论关闭
IT虾米网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!