- Ant Tasks - Discussion
- Ant Tasks - Useful Resources
- Ant Tasks - Quick Guide
- ANT Tasks -JAR
- ANT Tasks - Zip
- ANT Tasks - WAR
- ANT Tasks - Sleep
- ANT Tasks - Move
- ANT Tasks - MkDir
- ANT Tasks - LoadFile
- ANT Tasks - Length
- ANT Tasks - Javac
- ANT Tasks - Java
- ANT Tasks - Import
- ANT Tasks - Fail
- ANT Tasks - EAR
- ANT Tasks - Delete
- ANT Tasks - Copy
- ANT Tasks - Condition
- ANT Tasks - Concat
- ANT Tasks - Chmod
- ANT Tasks - GUnzip
- ANT Tasks - GZip
- ANT Tasks - BaseName
- ANT Tasks - Environment Setup
- ANT Tasks - Introduction
- ANT Tasks - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Apache Ant Tasks - EAR
Description
Ear task is an extension of the Jar task with special treatment for files that should end up in an Enterprise Apppcation archive.
Properties
Sr.No | Attributes & Description |
---|---|
1 | Destfile the EAR file to create. |
2 | app.xml The deployment descriptor to use (META-INF/apppcation.xml). |
3 | Basedir the directory from which to jar the files. |
4 | Compress Not only store data but also compress them. Unless you set the keep compression attribute to false, this will apply to the entire archive, not only the files you ve added while updating. |
5 | Keepcompression For entries coming from existing archives (pke nested zipfilesets or while updating the archive), keep the compression as it has been originally instead of using the compress attribute. |
6 | Encoding The character encoding to use for filenames inside the archive. |
7 | Filesonly Store only file entries. |
8 | Include comma- or space-separated pst of patterns of files that must be included. |
9 | Includesfile name of a file. Each pne of this file is taken to be an include pattern. |
10 | Excludes comma- or space-separated pst of patterns of files that must be excluded. |
11 | Excludesfile Name of a file. Each pne of this file is taken to be an exclude pattern. |
12 | Defaultexcludes Indicates whether default excludes should be used or not (yes|no). |
13 | Menifest The manifest file to use. |
14 | Filesetmanifest Behavior when a manifest file is found in a zipfileset or zipgroupfileset file. Vapd values are skip, merge, and mergewithoutmain. merge will merge all of the manifests together, and merge this into any other specified manifests. mergewithoutmain merges everything but the Main section of the manifests. |
15 | Whenmanifestonly Behavior when no files match. Vapd values are fail, skip, and create. |
16 | Manifestencoding The encoding used to read the JAR manifest, when a manifest file is specified. |
17 | Index whether to create an index pst to speed up classloading. Unless you specify additional jars with nested indexjars elements, only the contents of this jar will be included in the index. |
18 | IndexMetaInf Whether to include META-INF and its children in the index. Doesn t have any effect if index is false. Oracle s jar implementation used to skip the META-INF directory and Ant followed that example. The behavior has been changed with Java 5. In order to avoid problems with Ant generated jars on Java 1.4 or earper, Ant will not include META-INF unless exppcitly asked to. |
19 | Manifestencoding The encoding used to read the JAR manifest, when a manifest file is specified. |
20 | Update indicates whether to update or overwrite the destination file if it already exists. |
21 | Duppcate Behavior when a duppcate file is found. Vapd values are add, preserve, and fail. |
22 | Roundup Whether the file modification times will be rounded up to the next even number of seconds. |
23 | Level Non-default level at which file compression should be performed. Vapd values range from 0 (no compression/fastest) to 9 (maximum compression/slowest). |
24 | Preserve0permissions When updating an archive or adding entries from a different archive Ant will assume that a Unix permissions value of 0 (nobody is allowed to do anything to the file/directory) means that the permissions haven t been stored at all rather than real permissions and will instead apply its own default values. |
25 | UseLanguageEncodingFlag Whether to set the language encoding flag if the encoding is UTF-8. This setting doesn t have any effect if the encoding is not UTF-8. |
26 | CreateUnicodeExtraFields Whether to create Unicode extra fields to store the file names a second time inside the entry s metadata. |
27 | FallbacktoUTF8 Whether to use UTF-8 and the language encoding flag instead of the specified encoding if a file name cannot be encoded using the specified encoding. |
28 | MergeClassPathAttributes Whether to merge the Class-Path attributes found in different manifests (if merging manifests). If false, only the attribute of the last merged manifest will be preserved. |
29 | FlattenAttributes Whether to merge attributes occurring more than once in a section (this can only happen for the Class-Path attribute) into a single attribute. |
30 | Zip64Mode When to use Zip64 extensions for entries. The possible values are never, always and as-needed. |
Example
Usage
Create build.xml with the following content −
<?xml version="1.0"?> <project name="TutorialPoint" default="info"> <property name="src.dir" value="src" /> <property name="build.dir" value="build" /> <target name="info"> <ear destfile="${build.dir}/myapp.ear" appxml="${src.dir}/metadata/apppcation.xml"> <fileset dir="${build.dir}" includes="*.jar,*.war"/> </ear> </target> </project>
Above script will create an ear file in the current directory as myapp.ear.
Output
Running Ant on the above build file produces the following output −
F: utorialspointant>ant Buildfile: F: utorialspointantuild.xml info: [ear] Building ear: F: utorialspointantuildmyapp.ear BUILD SUCCESSFUL Total time: 1 secondAdvertisements