![](/img/trans.png)
[英]How to include the jars referenced in “Java Build Path” section of an Eclipse project in a jar file generated with Ant using a build.xml file
[英]How to include libs and other non class folders in a project while creating a jar file using <jar> task in build.xml
在我的項目中,我可以將包包括在src文件夾下,但是我需要包括其他文件夾(不包含.java或.class文件)和庫。
在build.xml中使用<jar>
任務創建jar文件時,如何在項目中包含庫和其他非類文件夾?
這是我如何執行此操作的快照:
<jar destfile="adasim-${version}-deps.jar" manifest="resources/MANIFEST.MF">
<fileset dir="${class.dir}"/>
<fileset dir=".">
<include name="resources/xml/adasim.xsd"/>
<include name="resources/VERSION"/>
</fileset>
<archives>
<zips>
<fileset dir="${lib.dir}" includes="**/*.jar" excludes="**/junit*.jar"/>
</zips>
</archives>
</jar>
您可以使用<fileset>
選擇要復制到JAR中的文件,然后將<zips>
與JAR結合使用,以將這些內容包含在JAR中。
可以在ant手冊中找到大量的文檔。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.