如何在包括蚂蚁的jar文件目录结构? [英] How to include directory structure in an ant jar file?

查看:92
本文介绍了如何在包括蚂蚁的jar文件目录结构?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有点蚂蚁新手,而我无法正确地做一个罐子。作为一个例子,说我想要做一个罐子我StringUtil类。使用以下蚂蚁指令,我可以创建罐子,但问题是该目录结构会丢失。它只是把StringUtil.class在罐子的基本目录。我怎样才能纠正这种蚂蚁指令,使StringUtil.class是在罐子里的COM / test目录里面呢?

I am a bit of an ant newbie, and I'm having trouble making a jar correctly. As an example, say I want to make a jar with my StringUtil class. Using the following ant directive, I can create the jar, but the problem is that the directory structure is lost. It simply puts StringUtil.class in the base directory of the jar. How can I correct this ant directive so that StringUtil.class is inside the com/test directory in the jar?

<jar destfile="myjar.jar" >
  <fileset file="${build}/com/test/StringUtil.class"/>
</jar>

谢谢!

推荐答案

您需要告诉Ant来构建从基本目录的罐子,然后让它只包含所需的文件。像这样:

You need to tell Ant to build the jar from the base directory, then tell it to include only the desired file. Like so:

<jar destfile="myjar.jar" >
  <fileset dir="${build}" includes="com/test/StringUtil.class"/>
</jar>

下面是 &LT的文档,文件集&GT; 标签。

这篇关于如何在包括蚂蚁的jar文件目录结构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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