日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

ant實(shí)踐——3、運(yùn)行ANT

 一輝 2007-01-14
運(yùn)行Ant非常簡單,當(dāng)你正確地安裝Ant后,只要輸入ant就可以了。

沒有指定任何參數(shù)時(shí),Ant會在當(dāng)前目錄下查詢build.xml文件。如果找到了就用該文件作為buildfile。如果你用 -find 選項(xiàng)。Ant就會在上級目錄中尋找buildfile,直至到達(dá)文件系統(tǒng)的根。要想讓Ant使用其他的buildfile,可以用參數(shù) -buildfile file,這里file指定了你想使用的buildfile。

你也可以設(shè)定一些屬性,以覆蓋buildfile中指定的屬性值(參看property task)。可以用 -Dproperty=value 選項(xiàng),這里property是指屬性的名稱,而value則是指屬性的值。也可以用這種辦法來指定一些環(huán)境變量的值。你也可以用property task來存取環(huán)境變量。只要將 -DMYVAR=%MYVAR% (Windows)-DMYVAR=$MYVAR (Unix) 傳遞給Ant -你就可以在你的buildfile中用${MYVAR}來存取這些環(huán)境變量。

還有兩個(gè)選項(xiàng) -quite,告訴Ant運(yùn)行時(shí)只輸出少量的必要信息。而 -verbose,告訴Ant運(yùn)行時(shí)要輸出更多的信息。

可以指定執(zhí)行一個(gè)或多個(gè)target。當(dāng)省略target時(shí),Ant使用標(biāo)簽<project>的default屬性所指定的target。

如果有的話,-projecthelp 選項(xiàng)輸出項(xiàng)目的描述信息和項(xiàng)目target的列表。先列出那些有描述的,然后是沒有描述的target。

命令行選項(xiàng)總結(jié):
ant [options] [target [target2 [target3] ...]]
Options:
-help print this message
-projecthelp print project help information
-version print the version information and exit
-quiet be extra quiet
-verbose be extra verbose
-debug print debugging information
-emacs produce logging information without adornments
-logfile file use given file for log output
-logger classname the class that is to perform logging
-listener classname add an instance of class as a project listener
-buildfile file use specified buildfile
-find file search for buildfile towards the root of the filesystem and use the first one found
-Dproperty=value set property to value
例子
ant
使用當(dāng)前目錄下的build.xml運(yùn)行Ant,執(zhí)行缺省的target。
ant -buildfile test.xml
使用當(dāng)前目錄下的test.xml運(yùn)行Ant,執(zhí)行缺省的target。
ant -buildfile test.xml dist
使用當(dāng)前目錄下的test.xml運(yùn)行Ant,執(zhí)行一個(gè)叫做dist的target。
ant -buildfile test.xml -Dbuild=build/classes dist
使用當(dāng)前目錄下的test.xml運(yùn)行Ant,執(zhí)行一個(gè)叫做dist的target,并設(shè)定build屬性的值為build/classes。

文件


在Unix上,Ant的執(zhí)行腳本在做任何事之前都會source(讀并計(jì)算值)~/.antrc 文件;在Windows上,Ant的批處理文件會在開始時(shí)調(diào)用%HOME%\antrc_pre.bat,在結(jié)束時(shí)調(diào)用%HOME%\antrc_post.bat。你可以用這些文件配置或取消一些只有在運(yùn)行Ant時(shí)才需要的環(huán)境變量。看下面的例子。

環(huán)境變量

包裹腳本(wrapper scripts)使用下面的環(huán)境變量(如果有的話):
  • JAVACMD Java可執(zhí)行文件的絕對路徑。用這個(gè)值可以指定一個(gè)不同于JAVA_HOME/bin/java(.exe)的JVM。
  • ANT_OPTS 傳遞給JVM的命令行變量-例如,你可以定義屬性或設(shè)定Java堆的最大值
手工運(yùn)行Ant

如果你自己動手安裝(DIY)Ant,你可以用下面的命令啟動Ant:
java -Dant.home=c:\ant org.apache.tools.ant.Main [options] [target]
這個(gè)命令與前面的ant命令一樣。選項(xiàng)和target也和用ant命令時(shí)一樣。這個(gè)例子假定你的CLASSPATH包含:
  • ant.jar
  • jars/classes for your XML parser
  • the JDK‘s required jar/zip files

    本站是提供個(gè)人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多