Ant Jar Copy File To Meta-inf

On
  1. Ant Build Jar With Dependencies
  2. Ant Jar Task Include File

Hi,I am creating a jar file using jar taskI want place something.xml file in META-INF of the jar.But its giving error saying: Problem opening app/configuration/xmlsfiles/something.xml.The specified xml file is existing at the specified location. Still its throwing the error.What can be the problem.Regards,Bala.

Meta inf folder

WAR Task War DescriptionAn extension of the task with special treatment for files that shouldend up in the WEB-INF/lib, WEB-INF/classes or WEB-INFdirectories of the Web Application Archive.(The War task is a shortcut for specifying the particular layout of a WAR file. Thesame thing can be accomplished by using the prefix and fullpath attributesof zipfilesets in a Zip or Jar task.)The extended zipfileset element from the zip task (withattributes prefix, fullpath, and src) is available inthe War task. The task is also resource-enabled and will add nested resources andresource collections to the archive.Before Servlet API 2.5/Java EE 5, a WEB-INF/web.xml file was mandatory in a WARfile, so this task failed if the webxml attribute was missing.

Asthe web.xml file is now optional, the webxml attribute may now be madeoptional. However, as most real web applications do need a web.xml file, it is notoptional by default.

The task will fail if the file is not included, unlessthe needxmlfile attribute is set to false. The task will warn if more thanone web.xml file is added to the JAR through the filesets.Please note that the Zip format allows multiple files of the same fully-qualified name toexist within a single archive. This has been documented as causing various problems forunsuspecting users. If you wish to avoid this behavior you must set the duplicateattribute to a value other than its default, add. Parameters AttributeDescriptionRequireddestfilethe WAR file to create.Exactly one of the twowarfileDeprecated name of the file tocreate—use destfile instead.webxmlThe servlet configuration descriptor to use ( WEB-INF/web.xml).Yes, unless needxmlfile is true, the file is pulled in via a nestedfileset, or an existing WAR file is being updated.needxmlfileFlag to indicate whether or not the web.xml file is needed. It should be setto false when generating servlet 2.5+ WAR files without a web.xmlfile. Since Apache Ant 1.7No; default is truebasedirthe directory from which to jar the files.NocompressNot only store data but also compress them.

Unless you set the keepcompressionattribute to false, this will apply to the entire archive, not only the files you'veadded while updating.No; defaults to truekeepcompressionFor entries coming from existing archives (like nested zipfilesets or whileupdating the archive), keep the compression as it has been originally instead of usingthe compress attribute. Since Ant 1.6No; defaults to falseencodingThe character encoding to use for filenames inside the archive. It is notrecommended to change this value as the created archive will most likely be unreadable forJava otherwise.

See also theNo; defaults to UTF8filesonlyStore only file entriesNo; defaults to falseincludesComma- or space-separated list of patterns of files that must be included.No; defaults to all (.)includesfileName of a file. Each line of this file is taken to be an include patternNoexcludesComma- or space-separated list of patterns of files that must be excluded.No; defaults to default excludes or none if defaultexcludes is noexcludesfileName of a file. Each line of this file is taken to be an exclude patternNodefaultexcludesIndicates whether default excludes should be used or not ( yes no).No; defaults to yesmanifestthe manifest file to use.Nofilesetmanifestbehavior when a manifest is found in a zipfilesetor zipgroupfileset file. Valid values are skip, merge,and mergewithoutmain. Merge will merge all of the manifests together, and mergethis into any other specified manifests.

Mergewithoutmain merges everything but theMain section of the manifests.No; defaults to skipwhenmanifestonlybehavior when no files match. Valid values are fail, skip,and create.No; defaults to createupdateindicates whether to update or overwrite the destination file if it already exists.No; defaults to falseduplicatebehavior when a duplicate file is found. Valid values are add, preserve,and fail.No; defaults to addroundupWhether the file modification times will be rounded up to the next even number ofseconds.

Ant build jar with dependencies

Zip archives store file modification times with a granularity of 2 seconds, sothe times will either be rounded up or down. If you round down, the archive will always seemout-of-date when you rerun the task, so the default is to round up. Rounding up may lead to adifferent type of problems like JSPs inside a web archive that seem to be slightly more recentthan precompiled pages, rendering precompilation useless. Since Ant 1.6.2No; defaults to truelevelNon-default level at which file compression should be performed.

Ant Jar Copy File To Meta-inf

Valid values rangefrom 0 (no compression/fastest) to 9 (maximum compression/slowest). SinceAnt 1.7Nopreserve0permissionswhen updating an archive or adding entries from a different archive Ant will assume that aUnix permissions value of 0 (nobody is allowed to do anything to the file/directory) meansthat the permissions haven't been stored at all rather than real permissions and will insteadapply its own default values. Set this attribute to true if you really want topreserve the original permission field.

Ant Build Jar With Dependencies

Since Ant 1.8.0No; default is falseuseLanguageEncodingFlagWhether to set the language encoding flag if the encoding is UTF-8. This setting doesn'thave any effect if the encoding is not UTF-8. Since Ant 1.8.0. See alsotheNo; default is truecreateUnicodeExtraFieldsWhether to create Unicode extra fields to store the file names a second time inside theentry's metadata. Possible values are never, alwaysand not-encodeable which will only add Unicode extra fields if the file name cannot beencoded using the specified encoding. Since Ant 1.8.0.

See alsotheNo; default is neverfallbacktoUTF8Whether to use UTF-8 and the language encoding flag instead of the specified encoding if afile name cannot be encoded using the specified encoding. Since Ant 1.8.0.

Seealso theNo; default is falsemergeClassPathAttributesWhether to merge the Class-Path attributes found in different manifests (ifmerging manifests). If false, only the attribute of the last merged manifest will bepreserved.

Since Ant 1.8.0. Unless you also set flattenAttributesto true this may result in manifests containing multiple Class-Pathattributes which violates the manifest specification.No; default is falseflattenAttributesWhether to merge attributes occurring more than once in a section (this can only happen forthe Class-Path attribute) into a single attribute. Since Ant 1.8.0.No; default is falsezip64ModeWhen to use Zip64 extensions for entries. The possible valuesare never, always and as-needed. Since Ant 1.9.1.

See alsotheNo; default is neverParameters specified as nested elements libThe nested lib element specifies a. Allfiles included in this fileset will end up in the WEB-INF/lib directory of the warfile. ClassesThe nested classes element specifiesa.

Ant Jar Task Include File

All files included in this fileset will end up inthe WEB-INF/classes directory of the war file. WebinfThe nested webinf element specifiesa. All files included in this fileset will end up inthe WEB-INF directory of the war file. If this fileset includes a filenamed web.xml, the file is ignored and you will get a warning. MetainfThe nested metainf element specifiesa. All files included in this fileset will end up inthe META-INF directory of the war file. If this fileset includes a filenamed MANIFEST.MF, the file is ignored and you will get a warning.