org.apache.maven.plugin.war
Class AbstractWarMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.maven.plugin.war.AbstractWarMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
WarExplodedMojo, WarInPlaceMojo, WarManifestMojo, WarMojo

public abstract class AbstractWarMojo
extends org.apache.maven.plugin.AbstractMojo


Field Summary
protected  org.apache.maven.archiver.MavenArchiveConfiguration archive
          The maven archive configuration to use.
protected  org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager
          To look up Archiver/UnArchiver implementations
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractWarMojo()
           
 
Method Summary
 void buildExplodedWebapp(java.io.File webappDirectory)
           
 void buildWebapp(org.apache.maven.project.MavenProject project, java.io.File webappDirectory)
          Builds the webapp for the specified project.
 void copyResources(java.io.File sourceDirectory, java.io.File webappDirectory)
          Copies webapp webResources from the specified directory.
 void copyResources(org.apache.maven.model.Resource resource, java.io.File webappDirectory, java.util.Map filterProperties)
          Copies webapp webResources from the specified directory.
 void createJarArchive(java.io.File libDirectory)
          Generates the JAR.
 java.io.File getClassesDirectory()
           
 java.io.File getContainerConfigXML()
           
protected  java.lang.String[] getDependentWarExcludes()
          Returns a string array of the excludes to be used when adding dependent wars as an overlay onto this war.
protected  java.lang.String[] getDependentWarIncludes()
          Returns a string array of the includes to be used when adding dependent wars as an overlay onto this war.
protected  java.lang.String[] getExcludes()
          Returns a string array of the excludes to be used when assembling/copying the war.
protected  java.lang.String[] getIncludes()
          Returns a string array of the includes to be used when assembling/copying the war.
 java.lang.String getOutputFileNameMapping()
           
 org.apache.maven.project.MavenProject getProject()
           
 java.io.File getWarSourceDirectory()
           
 java.io.File getWebappDirectory()
           
 java.io.File getWebXml()
           
 void setClassesDirectory(java.io.File classesDirectory)
           
 void setContainerConfigXML(java.io.File containerConfigXML)
           
 void setOutputFileNameMapping(java.lang.String outputFileNameMapping)
           
 void setProject(org.apache.maven.project.MavenProject project)
           
 void setWarSourceDirectory(java.io.File warSourceDirectory)
           
 void setWebappDirectory(java.io.File webappDirectory)
           
 void setWebXml(java.io.File webXml)
           
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.maven.plugin.Mojo
execute
 

Field Detail

archiverManager

protected org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager
To look up Archiver/UnArchiver implementations


archive

protected org.apache.maven.archiver.MavenArchiveConfiguration archive
The maven archive configuration to use.

Constructor Detail

AbstractWarMojo

public AbstractWarMojo()
Method Detail

getProject

public org.apache.maven.project.MavenProject getProject()

setProject

public void setProject(org.apache.maven.project.MavenProject project)

getClassesDirectory

public java.io.File getClassesDirectory()

setClassesDirectory

public void setClassesDirectory(java.io.File classesDirectory)

getWebappDirectory

public java.io.File getWebappDirectory()

setWebappDirectory

public void setWebappDirectory(java.io.File webappDirectory)

getWarSourceDirectory

public java.io.File getWarSourceDirectory()

setWarSourceDirectory

public void setWarSourceDirectory(java.io.File warSourceDirectory)

getWebXml

public java.io.File getWebXml()

setWebXml

public void setWebXml(java.io.File webXml)

getContainerConfigXML

public java.io.File getContainerConfigXML()

setContainerConfigXML

public void setContainerConfigXML(java.io.File containerConfigXML)

getOutputFileNameMapping

public java.lang.String getOutputFileNameMapping()

setOutputFileNameMapping

public void setOutputFileNameMapping(java.lang.String outputFileNameMapping)

getExcludes

protected java.lang.String[] getExcludes()
Returns a string array of the excludes to be used when assembling/copying the war.

Returns:
an array of tokens to exclude

getIncludes

protected java.lang.String[] getIncludes()
Returns a string array of the includes to be used when assembling/copying the war.

Returns:
an array of tokens to include

getDependentWarExcludes

protected java.lang.String[] getDependentWarExcludes()
Returns a string array of the excludes to be used when adding dependent wars as an overlay onto this war.

Returns:
an array of tokens to exclude

getDependentWarIncludes

protected java.lang.String[] getDependentWarIncludes()
Returns a string array of the includes to be used when adding dependent wars as an overlay onto this war.

Returns:
an array of tokens to include

buildExplodedWebapp

public void buildExplodedWebapp(java.io.File webappDirectory)
                         throws org.apache.maven.plugin.MojoExecutionException,
                                org.apache.maven.plugin.MojoFailureException
Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException

copyResources

public void copyResources(org.apache.maven.model.Resource resource,
                          java.io.File webappDirectory,
                          java.util.Map filterProperties)
                   throws java.io.IOException
Copies webapp webResources from the specified directory.

Note that the webXml parameter could be null and may specify a file which is not named web.xml. If the file exists, it will be copied to the META-INF directory and renamed accordingly.

Parameters:
resource - the resource to copy
webappDirectory - the target directory
filterProperties -
Throws:
java.io.IOException - if an error occured while copying webResources

copyResources

public void copyResources(java.io.File sourceDirectory,
                          java.io.File webappDirectory)
                   throws java.io.IOException
Copies webapp webResources from the specified directory.

Note that the webXml parameter could be null and may specify a file which is not named web.xml. If the file exists, it will be copied to the META-INF directory and renamed accordingly.

Parameters:
sourceDirectory - the source directory
webappDirectory - the target directory
Throws:
java.io.IOException - if an error occured while copying webResources

createJarArchive

public void createJarArchive(java.io.File libDirectory)
                      throws org.apache.maven.plugin.MojoExecutionException
Generates the JAR.

Throws:
org.apache.maven.plugin.MojoExecutionException

buildWebapp

public void buildWebapp(org.apache.maven.project.MavenProject project,
                        java.io.File webappDirectory)
                 throws org.apache.maven.plugin.MojoExecutionException,
                        java.io.IOException,
                        org.apache.maven.plugin.MojoFailureException
Builds the webapp for the specified project.

Classes, libraries and tld files are copied to the webappDirectory during this phase.

Parameters:
project - the maven project
webappDirectory -
Throws:
java.io.IOException - if an error occured while building the webapp
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException


Copyright © 2002-2009 Apache Software Foundation. All Rights Reserved.