org.codehaus.plexus.archiver.war

Class WarArchiver

Implemented Interfaces:
Archiver

public class WarArchiver
extends JarArchiver

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.

See Also:
JarArchiver

Nested Class Summary

Nested classes/interfaces inherited from class org.codehaus.plexus.archiver.jar.JarArchiver

JarArchiver.FilesetManifestConfig

Field Summary

private File
deploymentDescriptor
our web.xml deployment descriptor
private boolean
descriptorAdded
flag set if the descriptor is added
private boolean
ignoreWebxml
flag set if finding the webxml is to be expected.

Fields inherited from class org.codehaus.plexus.archiver.jar.JarArchiver

INDEX_NAME, MANIFEST_NAME, configuredManifest, createEmpty, filesetManifest, filesetManifestConfig, index, indexJars, manifest, manifestEncoding, manifestFile, mergeManifestsMain, originalManifest, rootEntries, savedConfiguredManifest

Fields inherited from class org.codehaus.plexus.archiver.zip.AbstractZipArchiver

EMPTY_CRC, addedDirs, addedFiles, addingNewFiles, archiveType, comment, doCompress, doFilesonly, doUpdate, doubleFilePass, duplicate, encoding, entries, roundUp, savedDoUpdate, skipWriting

Fields inherited from class org.codehaus.plexus.archiver.AbstractArchiver

DEFAULT_DIR_MODE, DEFAULT_FILE_MODE, defaultDirectoryMode, defaultFileMode, destFile, dirsMap, filesMap, includeEmptyDirs, logger

Fields inherited from interface org.codehaus.plexus.archiver.Archiver

ROLE

Constructor Summary

WarArchiver()
constructor

Method Summary

void
addClass(File fileName)
add a file under WEB-INF/lib/
void
addClasses(File directoryName, String[] includes, String[] excludes)
add files under WEB-INF/classes
void
addLib(File fileName)
add a file under WEB-INF/lib/
void
addLibs(File directoryName, String[] includes, String[] excludes)
add files under WEB-INF/lib/
void
addWebinf(File directoryName, String[] includes, String[] excludes)
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
setIgnoreWebxml(boolean ignore)
void
setWebxml(File descr)
set the deployment descriptor to use (WEB-INF/web.xml); required unless update=true
protected void
zipFile(ArchiveEntry entry, ZipOutputStream zOut, String vPath, int mode)
Overridden from ZipArchiver class to deal with web.xml

Methods inherited from class org.codehaus.plexus.archiver.jar.JarArchiver

addConfiguredIndexJars, addConfiguredManifest, cleanUp, createEmptyZip, createIndexList, createManifest, filesetManifest, finalizeZipOutputStream, findJarName, getManifest, getManifest, grabFilesAndDirs, initZipOutputStream, reset, setFilesetmanifest, setIndex, setManifest, setManifestEncoding, writeIndexLikeList, writeManifest, zipFile

Methods inherited from class org.codehaus.plexus.archiver.zip.AbstractZipArchiver

addParentDirs, addResources, cleanUp, createArchive, createArchiveMain, createEmptyZip, finalizeZipOutputStream, getComment, getDirMode, getEncoding, getFileMode, getResourcesToAdd, getResourcesToUpdate, initZipOutputStream, isCompress, isFilesonly, isInUpdateMode, isRoundUp, reset, setComment, setCompress, setDirMode, setEncoding, setFileMode, setFilesonly, setRoundUp, setUpdateMode, zipDir, zipFile, zipFile

Methods inherited from class org.codehaus.plexus.archiver.AbstractArchiver

addDirectory, addDirectory, addDirectory, addDirectory, addFile, addFile, getDefaultDirectoryMode, getDefaultFileMode, getDestFile, getDirs, getFiles, getIncludeEmptyDirs, getLogger, setDefaultDirectoryMode, setDefaultFileMode, setDestFile, setIncludeEmptyDirs

Field Details

deploymentDescriptor

private File deploymentDescriptor
our web.xml deployment descriptor

descriptorAdded

private boolean descriptorAdded
flag set if the descriptor is added

ignoreWebxml

private boolean ignoreWebxml
flag set if finding the webxml is to be expected.

Constructor Details

WarArchiver

public WarArchiver()
constructor

Method Details

addClass

public void addClass(File fileName)
            throws ArchiverException
add a file under WEB-INF/lib/

addClasses

public void addClasses(File directoryName,
                       String[] includes,
                       String[] excludes)
            throws ArchiverException
add files under WEB-INF/classes

addLib

public void addLib(File fileName)
            throws ArchiverException
add a file under WEB-INF/lib/

addLibs

public void addLibs(File directoryName,
                    String[] includes,
                    String[] excludes)
            throws ArchiverException
add files under WEB-INF/lib/

addWebinf

public void addWebinf(File directoryName,
                      String[] includes,
                      String[] excludes)
            throws ArchiverException
files to add under WEB-INF;

cleanUp

protected void cleanUp()
Make sure we don't think we already have a web.xml next time this task gets executed.
Overrides:
cleanUp in interface JarArchiver

initZipOutputStream

protected void initZipOutputStream(ZipOutputStream zOut)
            throws IOException,
                   ArchiverException
override of parent; validates configuration before initializing the output stream.
Overrides:
initZipOutputStream in interface JarArchiver

setIgnoreWebxml

public void setIgnoreWebxml(boolean ignore)

setWebxml

public void setWebxml(File descr)
            throws ArchiverException
set the deployment descriptor to use (WEB-INF/web.xml); required unless update=true

zipFile

protected void zipFile(ArchiveEntry entry,
                       ZipOutputStream zOut,
                       String vPath,
                       int mode)
            throws IOException,
                   ArchiverException
Overridden from ZipArchiver class to deal with web.xml