Its content is completely ignored unless you set the index attribute of the task to true. The index created by this task will contain indices for the archives contained in this path, the names used for the archives depend on your manifest:. This task will not create any index entries for archives that are empty or only contain files inside the META-INF directory unless the indexmetainf attribute has been set to true.
The nested indexjarsmapper element can be used to perform custom filename transformations for the archives specified by indexjars if the default filename transformation doesn't suffice.
The nested service element specifies a service. Services are described in the service provider overview. ScriptEngineFactory which can include implementation class names, one per line usually just one per JAR. The name of the service is set by the type attribute.
The classname implementing the service is the the provider attribute, or if one wants to specify a number of classes that implement the service, by provider nested elements. Files with the name Test. Create an executable jar file with a main class com. This is an example of an inline manifest specification including the version of the build program Implementation-Version. Note that the Built-By attribute will take the value of the Ant property user.
The manifest produced by the above would look like this:. The following shows how to create a jar file specifying a service with an implementation of the scripting interface:. The following shows how to create a jar file specifying a service with two implementations of the scripting interface:.
It defines on top of a JAR the possibility to place additional or overwriting classes in a jar, which are available according to the Java version you run. Not only store data but also compress them.
Unless you set the keepcompression attribute to false , this will apply to the entire archive, not only the files you've added while updating. For entries coming from existing archives like nested zipfileset s or while updating the archive , keep the compression as it has been originally instead of using the compress attribute. Since Ant 1. The character encoding to use for filenames inside the archive.
It is not recommended to change this value as the created archive will most likely be unreadable for Java otherwise. See also the discussion in the zip task page.
This can be either the location of a manifest, or the name of a jar added through a fileset. Valid values are skip , merge , and mergewithoutmain.
Valid values are fail , skip , and create. Valid values are add , preserve , and fail. Unless you specify additional jars with nested indexjars elements, only the contents of this jar will be included in the index. If Windows' "compressed folders" is your primary consumer, then your best option is to explicitly set the encoding to the target platform. You may want to enable creation of Unicode extra fields so the tools that support them will extract the file names correctly.
Zip64 extensions provide a way to create archives bigger than 4 GB or holding more than entries—or add individual entries bigger than 4 GB using the ZIP extension field mechanism. These extensions are supported by most modern ZIP implementations. When Ant writes compressed entries into the archive it creates it doesn't know the compressed size of an entry before it has been written. Unfortunately the decision whether a Zip64 extra field will be written has to be made before writing the entry's content.
Ant 1. It supports three values: never means no Zip64 extra fields will ever be written. This is the behavior of Ant prior to 1. This is the default behavior of Ant 1. Unfortunately some ZIP implementations don't understand Zip64 extra fields or fail to parse archives with extra fields in local file headers that are not present in the central directory, one such implementation is the java. Archives created with as-needed can be read without problems with Java 6 and later.
Prior to Ant 1. Each file found in this fileset is added to the archive the same way that zipfileset src files are added. If manual. Files in the directory mydocs , or files with the name todo. Only html files under the directory api are zipped, and files with the name todo. Not only store data but also compress them.
Unless you set the keepcompression attribute to false , this will apply to the entire archive, not only the files you've added while updating. For entries coming from existing archives like nested zipfileset s or while updating the archive , keep the compression as it has been originally instead of using the compress attribute.
The character encoding to use for filenames inside the zip file. For a list of possible values see the Supported Encodings. Valid values are fail , skip , and create. Valid values are add , preserve , and fail. Whether the file modification times will be rounded up to the next even number of seconds.
Zip archives store file modification times with a granularity of 2 seconds, so the times will either be rounded up or down. If you round down, the archive will always seem out-of-date when you rerun the task, so the default is to round up. Rounding up may lead to a different type of problems like JSPs inside a web archive that seem to be slightly more recent than precompiled pages, rendering precompilation useless.
Non-default level at which file compression should be performed. Find centralized, trusted content and collaborate around the technologies you use most.
Connect and share knowledge within a single location that is structured and easy to search. The only problem is that my JavaDoc is being exported directly into the root directory of the resulting jar file. However, this pretty completely defeats the purpose of Ant as a completely automated build system. However, I obviously need to modify it to add source files, etc.
A jar is actually like a zip file. Hence you can use a zipfileset. Its attribute prefix is what you are looking for. The zipfileset command can accept either a zip file via src or a filesystem directory via dir.
Using the latter, you can add the following command:. Also worth to note is that zipfileset supports all attributes of fileset. Thus if you want to include just a single file in a specific location you can use:. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more.
0コメント