<分区>
Possible Duplicate:
Ant - how to get all files' name in a specific folder
我使用 ant 为我的项目创建了一个 jar 文件。我的项目有一些外部库。如何将这些外部库文件添加到可执行 jar。
我在带有外部 jar 的 list 中添加了 Class-path 属性。但它不起作用。
我如何添加外部库。
提前致谢。
<分区>
Possible Duplicate:
Ant - how to get all files' name in a specific folder
我使用 ant 为我的项目创建了一个 jar 文件。我的项目有一些外部库。如何将这些外部库文件添加到可执行 jar。
我在带有外部 jar 的 list 中添加了 Class-path 属性。但它不起作用。
我如何添加外部库。
提前致谢。
最佳答案
像这样:
<jar destfile="${jar.file}"
basedir="${build.dir}"
manifest="${manifest.file}">
<fileset dir="${classes.dir}" includes="**/*.class" />
<zipgroupfileset dir="${lib.dir}" includes="**/*.jar" />
</jar>
也许这也有帮助:
http://code.google.com/p/jarjar/
还有阅读这个:
http://docs.oracle.com/javase/tutorial/deployment/jar/downman.html
关于java - 使用 ant : How to add external library files to the executable jar 创建可执行 jar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13638890/