Package org.apache.tools.ant.taskdefs
Class War
- All Implemented Interfaces:
- Cloneable,- SelectorContainer
An extension of <jar> to create a WAR archive.
 Contains special treatment for files that should end up in the
 WEB-INF/lib, WEB-INF/classes or
 WEB-INF directories of the Web Application Archive.
(The War task is a shortcut for specifying the particular layout of a WAR file. The same thing can be accomplished by using the prefix and fullpath attributes of zipfilesets in a Zip or Jar task.)
The extended zipfileset element from the zip task (with attributes prefix, fullpath, and src) is available in the War task.
- Since:
- Ant 1.2
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from class org.apache.tools.ant.taskdefs.JarJar.FilesetManifestConfig, Jar.StrictModeNested classes/interfaces inherited from class org.apache.tools.ant.taskdefs.ZipZip.ArchiveState, Zip.Duplicate, Zip.UnicodeExtraField, Zip.WhenEmpty, Zip.Zip64ModeAttribute
- 
Field SummaryFields inherited from class org.apache.tools.ant.taskdefs.ZipaddedDirs, archiveType, doubleFilePass, duplicate, emptyBehavior, entries, skipWriting, zipFileFields inherited from class org.apache.tools.ant.taskdefs.MatchingTaskfilesetFields inherited from class org.apache.tools.ant.ProjectComponentdescription, location, project
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddClasses(ZipFileSet fs) add files under WEB-INF/classesvoidaddLib(ZipFileSet fs) add files under WEB-INF/lib/voidaddWebinf(ZipFileSet fs) files to add under WEB-INF;protected voidcleanUp()Make sure we don't think we already have a web.xml next time this task gets executed.protected voidoverride of parent; validates configuration before initializing the output stream.voidsetNeedxmlfile(boolean needxmlfile) Set the policy on the web.xml file, that is, whether or not it is neededvoidsetWarfile(File warFile) Deprecated.since 1.5.x.voidset the deployment descriptor to use (WEB-INF/web.xml); required unlessupdate=trueprotected voidzipFile(File file, ZipOutputStream zOut, String vPath, int mode) Overridden from Zip class to deal with web.xml Here are cases that can arise -not a web.xml file : add -first web.xml : add, remember we added it -same web.xml again: skip -alternate web.xml : warn and skipMethods inherited from class org.apache.tools.ant.taskdefs.JaraddConfiguredIndexJars, addConfiguredIndexJarsMapper, addConfiguredManifest, addConfiguredService, addMetainf, createEmptyZip, finalizeZipOutputStream, findJarName, getIndexJarsMapper, getResourcesToAdd, grabFilesAndDirs, reset, setFilesetmanifest, setFlattenAttributes, setIndex, setIndexMetaInf, setJarfile, setManifest, setManifestEncoding, setMergeClassPathAttributes, setStrict, setWhenempty, setWhenmanifestonly, writeIndexLikeList, zipFileMethods inherited from class org.apache.tools.ant.taskdefs.Zipadd, addFileset, addParentDirs, addResources, addResources, addZipfileset, addZipGroupFileset, execute, executeMain, getComment, getCreateUnicodeExtraFields, getCurrentExtraFields, getDestFile, getEncoding, getFallBackToUTF8, getLevel, getModificationtime, getNonFileSetResourcesToAdd, getPreserve0Permissions, getResourcesToAdd, getUseLanguageEnodingFlag, getZip64Mode, grabNonFileSetResources, grabResources, hasUpdatedFile, isAddingNewFiles, isCompress, isEmpty, isFirstPass, isInUpdateMode, logWhenWriting, selectDirectoryResources, selectFileResources, selectResources, setBasedir, setComment, setCompress, setCreateUnicodeExtraFields, setCurrentExtraFields, setDestFile, setDuplicate, setEncoding, setFallBackToUTF8, setFile, setFilesonly, setKeepCompression, setLevel, setModificationtime, setPreserve0Permissions, setRoundUp, setUpdate, setUseLanguageEncodingFlag, setZip64Mode, setZipfile, zipDir, zipDir, zipDir, zipFileMethods inherited from class org.apache.tools.ant.taskdefs.MatchingTaskadd, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addFilename, addMajority, addModified, addNone, addNot, addOr, addPresent, addSelector, addSize, addType, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getDirectoryScanner, getImplicitFileSet, getSelectors, hasSelectors, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setExcludes, setExcludesfile, setFollowSymlinks, setIncludes, setIncludesfile, setProject, XsetIgnore, XsetItemsMethods inherited from class org.apache.tools.ant.TaskbindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskTypeMethods inherited from class org.apache.tools.ant.ProjectComponentclone, getDescription, getLocation, getProject, setDescription, setLocation
- 
Constructor Details- 
Warpublic War()Constructor for the War Task.
 
- 
- 
Method Details- 
setWarfileDeprecated.since 1.5.x. Use setDestFile(File) insteadDeprecated name of the file to create -usedestfileinstead.- Parameters:
- warFile- the destination file
 
- 
setWebxmlset the deployment descriptor to use (WEB-INF/web.xml); required unlessupdate=true- Parameters:
- descr- the deployment descriptor file
 
- 
setNeedxmlfilepublic void setNeedxmlfile(boolean needxmlfile) Set the policy on the web.xml file, that is, whether or not it is needed- Parameters:
- needxmlfile- whether a web.xml file is needed. Default: true
 
- 
addLibadd files under WEB-INF/lib/- Parameters:
- fs- the zip file set to add
 
- 
addClassesadd files under WEB-INF/classes- Parameters:
- fs- the zip file set to add
 
- 
addWebinffiles to add under WEB-INF;- Parameters:
- fs- the zip file set to add
 
- 
initZipOutputStreamoverride of parent; validates configuration before initializing the output stream.- Overrides:
- initZipOutputStreamin class- Jar
- Parameters:
- zOut- the zip output stream
- Throws:
- IOException- on output error
- BuildException- if invalid configuration
 
- 
zipFileOverridden from Zip class to deal with web.xml Here are cases that can arise -not a web.xml file : add -first web.xml : add, remember we added it -same web.xml again: skip -alternate web.xml : warn and skip- Overrides:
- zipFilein class- Zip
- Parameters:
- file- the file to add to the archive
- zOut- the stream to write to
- vPath- the name this entry shall have in the archive
- mode- the Unix permissions to set.
- Throws:
- IOException- on output error
 
- 
cleanUpprotected void cleanUp()Make sure we don't think we already have a web.xml next time this task gets executed.
 
-