ant build里如何指定classpath
生活随笔
收集整理的這篇文章主要介紹了
ant build里如何指定classpath
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
我的jsp項目里使用到了tomcat安裝目錄的lib文件夾下的jar包,因此在ant build時,需要將tomcat/lib也引入classpath:
build.xml源代碼如下:
<?xml version="1.0"?> <project name="jerryjsp" basedir="." default="build"><property name="src.dir" value="src"/><property name="web.dir" value="WebContent"/><property name="build.dir" value="${web.dir}/WEB-INF/classes"/><property name="name" value="jerryjsp"/><path id="master-classpath"><fileset dir="${web.dir}/WEB-INF/lib"><include name="*.jar"/></fileset><fileset dir="C:/MyApp/apache-tomcat-9.0.29/lib"><include name="*.jar"/></fileset><pathelement path="${build.dir}"/></path><target name="build" description="Compile source tree java files"><mkdir dir="${build.dir}"/><javac destdir="${build.dir}" source="1.8" target="1.8"><src path="${src.dir}"/><classpath refid="master-classpath"/></javac></target><target name="clean" description="Clean output directories"><delete><fileset dir="${build.dir}"><include name="**/*.class"/></fileset></delete></target> </project>使用path標簽定義一個id為master-classpath的路徑:
在ant target里,使用javac標簽頁執行編譯,使用classpath標簽頁引入上述path標簽指定的classpath:
ant build執行成功:
要獲取更多Jerry的原創文章,請關注公眾號"汪子熙":
總結
以上是生活随笔為你收集整理的ant build里如何指定classpath的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 腾讯计划投资更多海外游戏资产 总投资已近
- 下一篇: 苹果还得依赖中国制造 国产厂商立讯首次加