编译ant.xml,第三方jar文件怎么加进去

编译ant.xml,第三方jar文件怎么加进去,第1张

你说的是ant的构建文件build.xml吗? 如果是 只要在jar标签中添加

<zipgroupfileset dir="${lib.dir}" includes="*.jar" />

例如:

<jar destfile=xxx >

<zipgroupfileset dir="${lib.dir}" includes="*.jar" /> //意思就是添加lib下所有的jar包

</jar>

ant 的 build.xml 中指定引用的位置,,,,,,其实,放哪都可以,但建议放 项目目录的lib目录里面。

~~~~~~~btw,换maven2吧,这样包的管理也方便

我抄一个例子给你,自己去领会吧。

build.properties:

classpath.external=C\:\\ExadelStudio\\lib\\servlet\\2.3\\servlet.jar

build.xml:

<project name= "empty " basedir= "../ " default= "build ">

<!-- Local system paths -->

<property file= "${basedir}/ant/build.properties "/>

<!--property name= "deploy.dir " value= "${exadel.home}/tomcat/webapps "/-->

<property name= "webroot.dir " value= "${basedir}/WebContent "/>

<property name= "webinf.dir " value= "${webroot.dir}/WEB-INF "/>

<property name= "build.dir " value= "build "/>

<!-- Project settings -->

<property name= "project.distname " value= "empty "/>

<!-- classpath for Struts 1.1 -->

<path id= "compile.classpath ">

<pathelement path = "${webinf.dir}/lib/commons-beanutils.jar "/>

<pathelement path = "${webinf.dir}/lib/commons-digester.jar "/>

<pathelement path = "${webinf.dir}/lib/struts.jar "/>

<pathelement path = "${webinf.dir}/classes "/>

<pathelement path = "${classpath.external} "/>

<pathelement path = "${classpath} "/>

</path>

<!-- Check timestamp on files -->

<target name= "prepare ">

<tstamp/>

</target>

<!-- Copy any resource or configuration files -->

<target name= "resources ">

<copy todir= "${webinf.dir}/classes " includeEmptyDirs= "no ">

<fileset dir= "JavaSource ">

<patternset>

<include name= "**/*.conf "/>

<include name= "**/*.properties "/>

<include name= "**/*.xml "/>

</patternset>

</fileset>

</copy>

</target>

<!-- Normal build of application -->

<target name= "compile " depends= "prepare,resources ">

<javac srcdir= "JavaSource " destdir= "${webinf.dir}/classes ">

<classpath refid= "compile.classpath "/>

</javac>

</target>

<!-- Remove classes directory for clean build -->

<target name= "clean "

description= "Prepare for clean build ">

<delete dir= "${webinf.dir}/classes "/>

<mkdir dir= "${webinf.dir}/classes "/>

</target>

<!-- Build entire project -->

<target name= "build " depends= "prepare,compile "/>

<target name= "rebuild " depends= "clean,prepare,compile "/>

</project>


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/bake/11801491.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-18
下一篇 2023-05-18

发表评论

登录后才能评论

评论列表(0条)

保存