日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Ant步步为营(4)ant启动tomcat

發(fā)布時(shí)間:2024/7/19 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Ant步步为营(4)ant启动tomcat 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

前序:

最近產(chǎn)品要release,一直忙著測試,沒有時(shí)間學(xué)習(xí)ant了,今天終于沒什么事了趕緊寫點(diǎn)東西。這個(gè)啟動(dòng)tomcat是好些天之前寫的了。在這里跟大家分享一下。

build.xml

<?xml version="1.0"?>
?? ?<project name="ForTest" default="start_tomcat" >
?? ?<property file="build.properties"></property>
?? ??? ?<target name="stop_tomcat"> ?
??????? <echo>停止tomcat</echo> ?
??????? <exec executable="cmd" dir="${tomcat.home}/bin" failοnerrοr="false"? ?
??????????????????? output="${log.file}" append="true" > ?
??????????? <!-- <arg value="/c" /> -->??? ?
??????????? <env key="CATALINA_HOME" path="${tomcat.home}"/>
?? ??? ??? ?<arg value="/c"/>
?? ??? ??? ?<arg value="shutdown.bat"/>? ?
??????? </exec> ?
??? </target> ?
?
??? <target name="start_tomcat" depends="stop_tomcat"> ?
??????? <echo>啟動(dòng)tomcat</echo> ?
??????? <exec executable="cmd" dir="${tomcat.home}/bin"? failοnerrοr="false"? ?
??????????????????? output="${log.file}" append="true" > ?
???????????? <!-- <arg value="/c" /> -->?? ?
???????????? <env key="CATALINA_HOME" path="${tomcat.home}"/> ?
???????????? <arg value="/c startup.bat" />??? ?
??????? </exec> ?
??? </target> ?
?? ?</project>

build.properties

tomcat.home=G:\\apache-tomcat-7.0.42-windows-x64\\apache-tomcat-7.0.42

?

注意幾點(diǎn):

exec executable="cmd"這一句是用在window系統(tǒng)下用cmd的方式啟動(dòng)tomcat。

<env key="CATALINA_HOME" path="${tomcat.home}"/>必須指明CATALINA_HOME的值。

env是ant的數(shù)據(jù)類型,參考:http://www.cnblogs.com/xionghui/archive/2012/03/13/2393679.html

/c的解釋:(參考ant api)

Windows Users

The <exec> task delegates to Runtime.exec which in turn apparently calls ::CreateProcess. It is the latter Win32 function that defines the exact semantics of the call. In particular, if you do not put a file extension on the executable, only ".EXE" files are looked for, not ".COM", ".CMD" or other file types listed in the environment variable PATHEXT. That is only used by the shell.

Note that .bat files cannot in general by executed directly. One normally needs to execute the command shell executable cmd using the /c switch.

<target name="help"><exec executable="cmd"><arg value="/c"/><arg value="ant.bat"/><arg value="-p"/></exec> </target>

A common problem is not having the executable on the PATH. In case you get an error message Cannot run program "...":CreateProcess error=2. The system cannot find the path specified. have a look at your PATH variable. Just type the command directly on the command line and if Windows finds it, Ant should do it too. (Otherwise ask on the user mailinglist for help.) If Windows can not execute the program add the directory of the program to the PATH (set PATH=%PATH%;dirOfProgram) or specify the absolute path in the executable attribute in your buildfile.

?

?

轉(zhuǎn)載于:https://www.cnblogs.com/QAZLIU/p/3732273.html

總結(jié)

以上是生活随笔為你收集整理的Ant步步为营(4)ant启动tomcat的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。