public abstract class AbstractWarMojo
extends org.apache.maven.plugin.AbstractMojo
Modifier and Type | Class and Description |
---|---|
private class |
AbstractWarMojo.DefaultWarPackagingContext
WarPackagingContext default implementation
|
Modifier and Type | Field and Description |
---|---|
private org.apache.maven.archiver.MavenArchiveConfiguration |
archive
The archive configuration to use.
|
private boolean |
archiveClasses
Whether a JAR file will be created for the classes in the webapp.
|
private org.codehaus.plexus.archiver.manager.ArchiverManager |
archiverManager
To look up Archiver/UnArchiver implementations.
|
private org.apache.maven.artifact.factory.ArtifactFactory |
artifactFactory |
private java.io.File |
cacheFile
The file containing the webapp structure cache.
|
private java.io.File |
classesDirectory
The directory containing compiled classes.
|
private java.io.File |
containerConfigXML
The path to a configuration file for the servlet container.
|
private Overlay |
currentProjectOverlay |
private java.util.LinkedHashSet<java.lang.String> |
delimiters
Set of delimiters for expressions to filter within the resources.
|
private java.lang.String |
dependentWarExcludes
The comma separated list of tokens to exclude when doing a WAR overlay.
|
private java.lang.String |
dependentWarIncludes
The comma separated list of tokens to include when doing a WAR overlay.
|
private boolean |
escapedBackslashesInFilePath
To escape interpolated values with Windows path
c:\foo\bar will be replaced with
c:\\foo\\bar . |
protected java.lang.String |
escapeString
Expression preceded with this String won't be interpolated.
|
private boolean |
filteringDeploymentDescriptors
To filter deployment descriptors.
|
private java.util.List<java.lang.String> |
filters
Filters (property files) to include during the interpolation of the pom.xml.
|
private boolean |
includeEmptyDirectories |
private org.codehaus.plexus.archiver.jar.JarArchiver |
jarArchiver
The JAR archiver needed for archiving the classes directory into a JAR file under WEB-INF/lib.
|
private org.apache.maven.shared.filtering.MavenFileFilter |
mavenFileFilter |
private org.apache.maven.shared.filtering.MavenResourcesFiltering |
mavenResourcesFiltering |
private static java.lang.String |
META_INF |
private java.util.List<java.lang.String> |
nonFilteredFileExtensions
A list of file extensions that should not be filtered.
|
private java.lang.String |
outputFileNameMapping
The file name mapping to use when copying libraries and TLDs.
|
private java.util.List<Overlay> |
overlays
The overlays to apply.
|
private org.apache.maven.project.MavenProject |
project
The Maven project.
|
private boolean |
recompressZippedFiles
Indicates if zip archives (jar,zip etc) being added to the war should be compressed again.
|
private java.lang.String |
resourceEncoding
The encoding to use when copying filtered web resources.
|
private org.apache.maven.execution.MavenSession |
session |
private boolean |
supportMultiLineFiltering
Stop searching endToken at the end of line
|
private boolean |
useCache
Whether the cache should be used to save the status of the webapp across multiple runs.
|
private boolean |
useDefaultDelimiters
Use default delimiters in addition to custom delimiters, if any.
|
private boolean |
useJvmChmod
use jvmChmod rather that cli chmod and forking process
|
private java.io.File |
warSourceDirectory
Single directory for extra files to include in the WAR.
|
private java.lang.String |
warSourceExcludes
The comma separated list of tokens to exclude when copying the content of the warSourceDirectory.
|
private java.lang.String |
warSourceIncludes
The comma separated list of tokens to include when copying the content of the warSourceDirectory.
|
private static java.lang.String |
WEB_INF |
private java.io.File |
webappDirectory
The directory where the webapp is built.
|
private org.apache.maven.model.Resource[] |
webResources
The list of webResources we want to transfer.
|
private java.io.File |
webXml
The path to the web.xml file to use.
|
private java.io.File |
workDirectory
Directory to unpack dependent WARs into if needed.
|
Constructor and Description |
---|
AbstractWarMojo() |
Modifier and Type | Method and Description |
---|---|
void |
addOverlay(Overlay overlay) |
void |
buildExplodedWebapp(java.io.File webapplicationDirectory) |
void |
buildWebapp(org.apache.maven.project.MavenProject mavenProject,
java.io.File webapplicationDirectory)
Builds the webapp for the specified project with the new packaging task thingy.
|
org.apache.maven.archiver.MavenArchiveConfiguration |
getArchive() |
org.apache.maven.artifact.factory.ArtifactFactory |
getArtifactFactory() |
java.io.File |
getCacheFile() |
java.io.File |
getClassesDirectory() |
java.io.File |
getContainerConfigXML() |
Overlay |
getCurrentProjectOverlay() |
protected java.lang.String[] |
getDependentWarExcludes()
Returns a string array of the excludes to be used when adding dependent WAR 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 copying the content of the WAR source directory.
|
java.util.List<java.lang.String> |
getFilters() |
protected java.lang.String[] |
getIncludes()
Returns a string array of the includes to be used when assembling/copying the WAR.
|
org.codehaus.plexus.archiver.jar.JarArchiver |
getJarArchiver() |
java.util.List<java.lang.String> |
getNonFilteredFileExtensions() |
java.lang.String |
getOutputFileNameMapping() |
java.util.List<Overlay> |
getOverlays() |
private java.util.List<WarPackagingTask> |
getPackagingTasks(OverlayManager overlayManager)
Returns a List of the
WarPackagingTask
instances to invoke to perform the packaging. |
private java.util.List<WarPostPackagingTask> |
getPostPackagingTasks()
Returns a List of the
WarPostPackagingTask instances to
invoke to perform the post-packaging. |
org.apache.maven.project.MavenProject |
getProject() |
protected org.apache.maven.execution.MavenSession |
getSession() |
java.io.File |
getWarSourceDirectory() |
java.lang.String |
getWarSourceExcludes() |
java.lang.String |
getWarSourceIncludes() |
java.io.File |
getWebappDirectory() |
org.apache.maven.model.Resource[] |
getWebResources() |
java.io.File |
getWebXml() |
java.io.File |
getWorkDirectory() |
boolean |
isArchiveClasses() |
protected boolean |
isIncludeEmptyDirectories() |
protected boolean |
isRecompressZippedFiles() |
boolean |
isUseCache() |
void |
setArchiveClasses(boolean archiveClasses) |
void |
setArtifactFactory(org.apache.maven.artifact.factory.ArtifactFactory artifactFactory) |
void |
setCacheFile(java.io.File cacheFile) |
void |
setClassesDirectory(java.io.File classesDirectory) |
void |
setContainerConfigXML(java.io.File containerConfigXML) |
void |
setFilters(java.util.List<java.lang.String> filters) |
void |
setJarArchiver(org.codehaus.plexus.archiver.jar.JarArchiver jarArchiver) |
void |
setNonFilteredFileExtensions(java.util.List<java.lang.String> nonFilteredFileExtensions) |
void |
setOutputFileNameMapping(java.lang.String outputFileNameMapping) |
void |
setOverlays(java.util.List<Overlay> overlays) |
void |
setProject(org.apache.maven.project.MavenProject project) |
void |
setUseCache(boolean useCache) |
void |
setWarSourceDirectory(java.io.File warSourceDirectory) |
void |
setWarSourceExcludes(java.lang.String warSourceExcludes) |
void |
setWarSourceIncludes(java.lang.String warSourceIncludes) |
void |
setWebappDirectory(java.io.File webappDirectory) |
void |
setWebResources(org.apache.maven.model.Resource[] webResources) |
void |
setWebXml(java.io.File webXml) |
void |
setWorkDirectory(java.io.File workDirectory) |
getLog, getPluginContext, setLog, setPluginContext
private static final java.lang.String META_INF
private static final java.lang.String WEB_INF
@Parameter(defaultValue="${project}", readonly=true, required=true) private org.apache.maven.project.MavenProject project
@Parameter(defaultValue="${project.build.outputDirectory}", required=true, readonly=true) private java.io.File classesDirectory
@Parameter(defaultValue="false") private boolean archiveClasses
@Parameter(defaultValue="${project.build.sourceEncoding}") private java.lang.String resourceEncoding
@Component(role=org.codehaus.plexus.archiver.Archiver.class, hint="jar") private org.codehaus.plexus.archiver.jar.JarArchiver jarArchiver
@Parameter(defaultValue="${project.build.directory}/${project.build.finalName}", required=true) private java.io.File webappDirectory
@Parameter(defaultValue="${basedir}/src/main/webapp", required=true) private java.io.File warSourceDirectory
@Parameter private org.apache.maven.model.Resource[] webResources
@Parameter private java.util.List<java.lang.String> filters
@Parameter private java.util.LinkedHashSet<java.lang.String> delimiters
Set of delimiters for expressions to filter within the resources. These delimiters are specified in the form 'beginToken*endToken'. If no '*' is given, the delimiter is assumed to be the same for start and end.
So, the default filtering delimiters might be specified as:
<delimiters> <delimiter>${*}</delimiter> <delimiter>@</delimiter> </delimiters>
Since the '@' delimiter is the same on both ends, we don't need to specify '@*@' (though we can).
@Parameter(defaultValue="true") private boolean useDefaultDelimiters
@Parameter private java.io.File webXml
@Parameter private java.io.File containerConfigXML
@Parameter(defaultValue="${project.build.directory}/war/work", required=true) private java.io.File workDirectory
@Parameter private java.lang.String outputFileNameMapping
@Parameter(defaultValue="${project.build.directory}/war/work/webapp-cache.xml", required=true) private java.io.File cacheFile
@Parameter(defaultValue="false") private boolean useCache
@Component(role=org.apache.maven.artifact.factory.ArtifactFactory.class) private org.apache.maven.artifact.factory.ArtifactFactory artifactFactory
@Component(role=org.codehaus.plexus.archiver.manager.ArchiverManager.class) private org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager
@Component(role=org.apache.maven.shared.filtering.MavenFileFilter.class, hint="default") private org.apache.maven.shared.filtering.MavenFileFilter mavenFileFilter
@Component(role=org.apache.maven.shared.filtering.MavenResourcesFiltering.class, hint="default") private org.apache.maven.shared.filtering.MavenResourcesFiltering mavenResourcesFiltering
@Parameter(defaultValue="**") private java.lang.String warSourceIncludes
@Parameter private java.lang.String warSourceExcludes
@Parameter private java.lang.String dependentWarIncludes
Overlay.DEFAULT_INCLUDES
@Parameter private java.lang.String dependentWarExcludes
Overlay.DEFAULT_EXCLUDES
@Parameter private java.util.List<Overlay> overlays
@Parameter private java.util.List<java.lang.String> nonFilteredFileExtensions
@Parameter(defaultValue="${session}", readonly=true, required=true) private org.apache.maven.execution.MavenSession session
@Parameter(defaultValue="false") private boolean filteringDeploymentDescriptors
@Parameter(defaultValue="false") private boolean escapedBackslashesInFilePath
c:\foo\bar
will be replaced with
c:\\foo\\bar
.@Parameter protected java.lang.String escapeString
\${foo}
will be replaced with
${foo}
.@Parameter(defaultValue="true") private boolean recompressZippedFiles
@Parameter(defaultValue="false") private boolean includeEmptyDirectories
@Parameter(defaultValue="false") private boolean supportMultiLineFiltering
@Parameter(defaultValue="true") private boolean useJvmChmod
@Parameter private org.apache.maven.archiver.MavenArchiveConfiguration archive
private final Overlay currentProjectOverlay
public Overlay getCurrentProjectOverlay()
protected java.lang.String[] getExcludes()
protected java.lang.String[] getIncludes()
protected java.lang.String[] getDependentWarExcludes()
protected java.lang.String[] getDependentWarIncludes()
public void buildExplodedWebapp(java.io.File webapplicationDirectory) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
webapplicationDirectory
- The web application directory.org.apache.maven.plugin.MojoExecutionException
- In case of failure.org.apache.maven.plugin.MojoFailureException
- In case of failure.public void buildWebapp(org.apache.maven.project.MavenProject mavenProject, java.io.File webapplicationDirectory) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException, java.io.IOException
mavenProject
- the maven projectwebapplicationDirectory
- the target directoryorg.apache.maven.plugin.MojoExecutionException
- if an error occurred while packaging the webapporg.apache.maven.plugin.MojoFailureException
- if an unexpected error occurred while packaging the webappjava.io.IOException
- if an error occurred while copying the filesprivate java.util.List<WarPackagingTask> getPackagingTasks(OverlayManager overlayManager) throws org.apache.maven.plugin.MojoExecutionException
WarPackagingTask
instances to invoke to perform the packaging.overlayManager
- the overlay managerorg.apache.maven.plugin.MojoExecutionException
- if the packaging tasks could not be builtprivate java.util.List<WarPostPackagingTask> getPostPackagingTasks()
WarPostPackagingTask
instances to
invoke to perform the post-packaging.public org.apache.maven.project.MavenProject getProject()
public void setProject(org.apache.maven.project.MavenProject project)
project
- The project to be set.public java.io.File getClassesDirectory()
public void setClassesDirectory(java.io.File classesDirectory)
classesDirectory
- The classes directory to be set.public java.io.File getWebappDirectory()
webappDirectory
public void setWebappDirectory(java.io.File webappDirectory)
webappDirectory
- The web application directory.public java.io.File getWarSourceDirectory()
warSourceDirectory
public void setWarSourceDirectory(java.io.File warSourceDirectory)
warSourceDirectory
- warSourceDirectory
public java.io.File getWebXml()
webXml
public void setWebXml(java.io.File webXml)
webXml
- The webXml
public java.io.File getContainerConfigXML()
containerConfigXML
public void setContainerConfigXML(java.io.File containerConfigXML)
containerConfigXML
- containerConfigXML
public java.lang.String getOutputFileNameMapping()
outputFileNameMapping
public void setOutputFileNameMapping(java.lang.String outputFileNameMapping)
outputFileNameMapping
- outputFileNameMapping
public void setOverlays(java.util.List<Overlay> overlays)
overlays
- overlays
public boolean isArchiveClasses()
archiveClasses
public void setArchiveClasses(boolean archiveClasses)
archiveClasses
- archiveClasses
public org.codehaus.plexus.archiver.jar.JarArchiver getJarArchiver()
JarArchiver
public void setJarArchiver(org.codehaus.plexus.archiver.jar.JarArchiver jarArchiver)
jarArchiver
- JarArchiver
public org.apache.maven.model.Resource[] getWebResources()
webResources
.public void setWebResources(org.apache.maven.model.Resource[] webResources)
webResources
- webResources
.public java.util.List<java.lang.String> getFilters()
filters
public void setFilters(java.util.List<java.lang.String> filters)
filters
- filters
public java.io.File getWorkDirectory()
workDirectory
public void setWorkDirectory(java.io.File workDirectory)
workDirectory
- workDirectory
public java.io.File getCacheFile()
cacheFile
public void setCacheFile(java.io.File cacheFile)
cacheFile
- cacheFile
public java.lang.String getWarSourceIncludes()
warSourceIncludes
public void setWarSourceIncludes(java.lang.String warSourceIncludes)
warSourceIncludes
- warSourceIncludes
public java.lang.String getWarSourceExcludes()
warSourceExcludes
public void setWarSourceExcludes(java.lang.String warSourceExcludes)
warSourceExcludes
- warSourceExcludes
public boolean isUseCache()
useCache
public void setUseCache(boolean useCache)
useCache
- useCache
public org.apache.maven.archiver.MavenArchiveConfiguration getArchive()
archive
public java.util.List<java.lang.String> getNonFilteredFileExtensions()
nonFilteredFileExtensions
public void setNonFilteredFileExtensions(java.util.List<java.lang.String> nonFilteredFileExtensions)
nonFilteredFileExtensions
- nonFilteredFileExtensions
public org.apache.maven.artifact.factory.ArtifactFactory getArtifactFactory()
artifactFactory
public void setArtifactFactory(org.apache.maven.artifact.factory.ArtifactFactory artifactFactory)
artifactFactory
- artifactFactory
protected org.apache.maven.execution.MavenSession getSession()
session
protected boolean isRecompressZippedFiles()
recompressZippedFiles
protected boolean isIncludeEmptyDirectories()
includeEmptyDirectories