📜  Apache Ant JAR示例

📅  最后修改于: 2020-12-26 13:45:35             🧑  作者: Mango

阿帕奇蚂蚁罐

JAR是一组Java类,称为Java存档文件。在Ant中,我们可以使用build.xml文件中的元素来创建Jar文件。

这是一项任务,隐式使用FileSet并支持它的属性。它还允许各种嵌套元素,例如等,并包含下面给出的属性。

Apache Ant Jar属性

Attribute Description Required
destfile The JAR file to create. Yes
basedir The directory from which to jar the files. No
compress Store and compress data. No
filesonly It is used to store only file entries. No
includes A list of patterns of files that must be included while creating Jar. No
excludes A list of patterns of files that must be excluded while creating Jar. No
update Indicates whether to update Jar or not. No
duplicate behavior when a duplicate file is found. Valid values are add, preserve, and fail. No
level Non-default level at which file compression should be performed. No
useLanguageEncodingFlag Whether to set the language encoding flag if the encoding is UTF-8. No
createUnicodeExtraFields Whether to create Unicode extra fields to store the file names a second time inside the entry’s metadata. No
fallbacktoUTF8 Whether to use UTF-8 and the language encoding flag instead of the specified encoding. No
flattenAttributes Whether to merge attributes occurring more than once in a section. No
zip64Mode When to use Zip64 extensions for entries. No

JAR示例

将$ {build} / classes目录中的所有文件打包到$ {dist} / lib目录中的app.jar文件中。