如何通过蚂蚁在特定的位置包括Jar文件 [英] How to include file in Jar through Ant at specific location

查看:147
本文介绍了如何通过蚂蚁在特定的位置包括Jar文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一只蚂蚁jar任务:

I've got an ant jar task:

<target name="jar">
    <jar destfile="${generated.jars.dir}/hello-${environment}.jar">
    	<fileset dir="${generated.classes.dir}"/>
    	<fileset dir="${environment.dir}/${environment}" includes="config.xml"/>
    </jar>
</target>

我怎么能强制config.xml文件推送到在罐子里,而不是在根级别的特定目录,例如在/database/config.xml或类似的东西...

How can I force the config.xml file to be pushed to a specific directory in the jar rather than at the root level, say in /database/config.xml or something like that...

PS:这样做的原因,这是我能有一个hello-local.jar,HELLO-dev.jar,HELLO-qa.jar等

PS: The reason for doing this is that I can have a hello-local.jar, hello-dev.jar, hello-qa.jar, etc.

推荐答案

使用一个 zipfileset 是这样的:

Use a zipfileset like this:

<jar destfile="${generated.jars.dir}/hello-${environment}.jar">
    <fileset dir="${generated.classes.dir}"/>
    <zipfileset dir="${environment.dir}/${environment}" 
                includes="config.xml"
                fullpath="database/config.xml"/>
</jar>

这篇关于如何通过蚂蚁在特定的位置包括Jar文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆