Ant:将源目录拆分为两个 Jar [英] Ant: Split Source Directory into Two Jars
本文介绍了Ant:将源目录拆分为两个 Jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从一个项目源文件夹创建两个 Jars?这是可能的,还是我必须创建另一个项目?我的项目现在使用 Ant 来生成一个 Jar.例如,假设我想像这样拆分类文件:
How does one go about creating two Jars from one project source folder? Is that possible, or must I create another project? My project uses Ant right now to generate one Jar. For example, say I want to split up the class files like this:
Jar 1:
com.myproject.Foo
com.myproject.Bar
Jar 2:
com.myproject.FooBar
com.myproject.BarFoo
com.myproject.FooBarFoo
...
推荐答案
参见 http://ant.apache.org/manual/Tasks/jar.html.您只需要在 jar 任务中使用文件集或包含/排除即可在每个 jar 中仅包含您想要的文件:
See http://ant.apache.org/manual/Tasks/jar.html. You just have to use filesets or includes/excludes inside your jar task to include only the files you want in each jar:
<target name="makeJars">
<jar destfile="jar1.jar"
basedir="classes"
includes="com/myproject/Foo.class, com/myproject/Bar.class"/>
<jar destfile="jar2.jar"
basedir="classes"
includes="com/myproject/FooBar.class, com/myproject/BarFoo.class, com/myproject/FooBarFoo.class" />
</target>
这篇关于Ant:将源目录拆分为两个 Jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文