ant build停止tomcat服务器

时间:2015-05-13 15:17:48

标签: ant

我试图用以下代码停止tomcat,

 <target name="tomcat-stop" if="tomcat.running" depends="check-port" >
  <echo message="Tomcat is running...stopping it"/> 
     <java jar="${tomcat.home}/bin/bootstrap.jar" fork="true" >
         <jvmarg value="-Dcatalina.home=${tomcat.home}"/>
         <arg line="stop"/>
     </java>
 </target>

它返回错误

  

“[java]错误:无法访问jarfile 10.50.255.250:\home\Deploymenttest\apache-tomcat-7.0.42\bin\bootstrap.jar        [java] Java结果:1“

1 个答案:

答案 0 :(得分:0)

我试过这种方式并且有效,

<target name="tomcat-stop" depends="check-port">
 <sshexec host="10.0.60.0"
    trust="true"
  username="${server_username}"
  password="${server_password}"
 command="sh /home/Deploymenttest/apache-tomcat-7.0.42/bin/shutdown.sh" />
  <!--command="cd /home/Deploymenttest/ rm -rf test"/>-->
   </target>