public class War extends Jar
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.
Jar
Jar.FilesetManifestConfig, Jar.StrictMode
Zip.ArchiveState, Zip.Duplicate, Zip.UnicodeExtraField, Zip.WhenEmpty, Zip.Zip64ModeAttribute
addedDirs, archiveType, doubleFilePass, duplicate, emptyBehavior, entries, skipWriting, zipFile
fileset
Constructor and Description |
---|
War()
Constructor for the War Task.
|
Modifier and Type | Method and Description |
---|---|
void |
addClasses(ZipFileSet fs)
add files under WEB-INF/classes
|
void |
addLib(ZipFileSet fs)
add files under WEB-INF/lib/
|
void |
addWebinf(ZipFileSet fs)
files to add under WEB-INF;
|
protected void |
cleanUp()
Make sure we don't think we already have a web.xml next time this task
gets executed.
|
protected void |
initZipOutputStream(ZipOutputStream zOut)
override of parent; validates configuration
before initializing the output stream.
|
void |
setNeedxmlfile(boolean needxmlfile)
Set the policy on the web.xml file, that is, whether or not it is needed
|
void |
setWebxml(File descr)
set the deployment descriptor to use (WEB-INF/web.xml);
required unless update=true
|
protected void |
zipFile(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 skip
|
addConfiguredIndexJars, addConfiguredManifest, addConfiguredService, addMetainf, createEmptyZip, finalizeZipOutputStream, findJarName, getResourcesToAdd, grabFilesAndDirs, reset, setFilesetmanifest, setFlattenAttributes, setIndex, setIndexMetaInf, setManifest, setManifestEncoding, setMergeClassPathAttributes, setStrict, setWhenempty, setWhenmanifestonly, writeIndexLikeList, zipFile
add, addFileset, addParentDirs, addResources, addResources, addZipfileset, addZipGroupFileset, execute, executeMain, getComment, getCreateUnicodeExtraFields, getCurrentExtraFields, getDestFile, getEncoding, getFallBackToUTF8, getLevel, 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, setFilesonly, setKeepCompression, setLevel, setPreserve0Permissions, setRoundUp, setUpdate, setUseLanguageEncodingFlag, setZip64Mode, zipDir, zipDir, zipDir, zipFile
add, 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, XsetItems
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
clone, getDescription, getLocation, getProject, setDescription, setLocation
public void addClasses(ZipFileSet fs)
fs
- the zip file set to addpublic void addLib(ZipFileSet fs)
fs
- the zip file set to addpublic void addWebinf(ZipFileSet fs)
fs
- the zip file set to addprotected void cleanUp()
cleanUp
in class Jar
Zip.cleanUp()
protected void initZipOutputStream(ZipOutputStream zOut) throws IOException, BuildException
initZipOutputStream
in class Jar
zOut
- the zip output streamIOException
- on output errorBuildException
- if invalid configurationpublic void setNeedxmlfile(boolean needxmlfile)
needxmlfile
- whether a web.xml file is needed. Default: truepublic void setWebxml(File descr)
descr
- the deployment descriptor fileprotected void zipFile(File file, ZipOutputStream zOut, String vPath, int mode) throws IOException
zipFile
in class Zip
file
- the file to add to the archivezOut
- the stream to write tovPath
- the name this entry shall have in the archivemode
- the Unix permissions to set.IOException
- on output error