ant build停止tomcat服务器

时间:2022-10-05 18:37:50

I am trying to stop tomcat with the below code,

我试图用下面的代码停止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>

.

It returns the error

它返回错误

"[java] Error: Unable to access jarfile 10.50.255.250:\home\Deploymenttest\apache-tomcat-7.0.42\bin\bootstrap.jar [java] Java Result: 1"

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

1 个解决方案

#1


I tried in this way and it works,

我试过这种方式,它的工作原理,

<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>

#1


I tried in this way and it works,

我试过这种方式,它的工作原理,

<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>