org.codehaus.plexus.archiver.war
Class WarArchiver

java.lang.Object
  extended by org.codehaus.plexus.logging.AbstractLogEnabled
      extended by org.codehaus.plexus.archiver.AbstractArchiver
          extended by org.codehaus.plexus.archiver.zip.AbstractZipArchiver
              extended by org.codehaus.plexus.archiver.zip.ZipArchiver
                  extended by org.codehaus.plexus.archiver.jar.JarArchiver
                      extended by org.codehaus.plexus.archiver.war.WarArchiver
All Implemented Interfaces:
Archiver, FilterEnabled, FinalizerEnabled, org.codehaus.plexus.logging.LogEnabled, org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable

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
 
Fields inherited from class org.codehaus.plexus.archiver.zip.AbstractZipArchiver
addedDirs, addingNewFiles, archiveType, doubleFilePass, duplicate, entries, skipWriting
 
Fields inherited from interface org.codehaus.plexus.archiver.Archiver
DEFAULT_DIR_MODE, DEFAULT_FILE_MODE, DUPLICATES_ADD, DUPLICATES_FAIL, DUPLICATES_PRESERVE, DUPLICATES_SKIP, DUPLICATES_VALID_BEHAVIORS, ROLE
 
Constructor Summary
WarArchiver()
           
 
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)
          Overridden from ZipArchiver class to deal with web.xml
 
Methods inherited from class org.codehaus.plexus.archiver.jar.JarArchiver
addConfiguredIndexJars, addConfiguredManifest, createEmptyZip, finalizeZipOutputStream, findJarName, grabFilesAndDirs, hasVirtualFiles, reset, setFilesetmanifest, setIndex, setManifest, setManifestEncoding, writeIndexLikeList, zipFile
 
Methods inherited from class org.codehaus.plexus.archiver.zip.AbstractZipArchiver
addParentDirs, addResources, close, execute, getArchiveType, getComment, getEncoding, getZipEntryNames, isCompress, isFileAdded, isFilesonly, isFileUpdated, isInUpdateMode, isRoundUp, isSupportingForced, revert, setComment, setCompress, setEncoding, setFilesonly, setRoundUp, setUpdateMode, zipDir
 
Methods inherited from class org.codehaus.plexus.archiver.AbstractArchiver
addArchivedFileSet, addArchivedFileSet, addArchivedFileSet, addArchivedFileSet, addArchivedFileSet, addArchiveFinalizer, addDirectory, addDirectory, addDirectory, addDirectory, addFile, addFile, addFileSet, addResource, addResources, asArchiveEntry, asArchiveEntry, asResourceCollection, checkForced, contextualize, createArchive, getArchiveFinalizers, getDefaultDirectoryMode, getDefaultFileMode, getDestFile, getDirectoryMode, getDirs, getDuplicateBehavior, getFileMode, getFiles, getIncludeEmptyDirs, getLogger, getOverrideDirectoryMode, getOverrideFileMode, getRawDefaultDirectoryMode, getRawDefaultFileMode, getResources, isForced, isIgnorePermissions, isUptodate, isUseJvmChmod, runArchiveFinalizers, setArchiveFilters, setArchiveFinalizers, setDefaultDirectoryMode, setDefaultFileMode, setDestFile, setDirectoryMode, setDotFileDirectory, setDuplicateBehavior, setFileMode, setForced, setIgnorePermissions, setIncludeEmptyDirs, setUseJvmChmod, validate
 
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WarArchiver

public WarArchiver()
Method Detail

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

Throws:
ArchiverException

addLib

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

Throws:
ArchiverException

addLibs

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

Throws:
ArchiverException

addClass

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

Throws:
ArchiverException

addClasses

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

Throws:
ArchiverException

addWebinf

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

Throws:
ArchiverException

initZipOutputStream

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

Overrides:
initZipOutputStream in class JarArchiver
Throws:
IOException
ArchiverException

zipFile

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

Overrides:
zipFile in class AbstractZipArchiver
Parameters:
entry - the file to add to the archive
zOut - the stream to write to
vPath - the name this entry shall have in the archive
Throws:
IOException
ArchiverException

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 class JarArchiver
See Also:
AbstractZipArchiver.cleanUp()


Copyright © 2008-2012 Sonatype, Inc.. All Rights Reserved.