Ant入门笔记
?
對ANT入門的例子在這里可以參考,其中注意事項(xiàng)為:
build.xml源碼
<!--網(wǎng)頁顯示的字符--> <?xml version="1.0" encoding="UTF-8"?><!--創(chuàng)建工程名為HelloWorld,工程有4個(gè)target,分別是init,compile,build,run,缺省的是run,4個(gè)target相互依賴--> <project name="HelloWorld" default="run" basedir="." ><property name="src" value="src"/><property name="dest" value="classes"/><property name="hello_jar" value="hello.jar" /><!--初始化當(dāng)前目錄為dest--><target name="init"><mkdir dir="${dest}"/></target><!--編譯當(dāng)前目錄下的src目錄中的HelloWorld.java程序--><target name="compile" depends="init"><javac srcdir="${src}" destdir="${dest}"/></target><!--build生成hello.jar,并存放在dest目錄下,--><target name="build" depends="compile"><jar jarfile="${hello_jar}" basedir="${dest}"/></target><!--run則是執(zhí)行這個(gè)HelloWorld類,用hello.jar作為classpath,因?yàn)閏om.sharetop.antdemo.HelloWorld.class在hello.jar壓縮包中,在build中生成的,并將結(jié)果顯示在終端--><target name="run" depends="build"><java classname="com.sharetop.antdemo.HelloWorld" classpath="${hello_jar}"/></target> </project>
注意: 經(jīng)常會(huì)出現(xiàn)以下錯(cuò)誤1。其中build失敗。解決方式:刪除<?xml version="1.0" encoding="UTF-8"?>前行的所有信息。格式原因吧,因此build.xml文件的首行只能是版本信息。
BUILD FAILED /home/administrator/antlib/build.xml:2: The processing instruction target matching "[xX][mM][lL]" is not allowed.Total time: 0 secondsattribute specifications, ">" or "/>". ?
?
轉(zhuǎn)載于:https://www.cnblogs.com/lyeoswu/p/ant.html
總結(jié)
- 上一篇: git clone
- 下一篇: CSS 编码中超级有用的工具集合