Package org.apache.maven.plugins.war
Class AbstractWarMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.maven.plugins.war.AbstractWarMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
WarExplodedMojo,WarInPlaceMojo,WarMojo
public abstract class AbstractWarMojo
extends org.apache.maven.plugin.AbstractMojo
Contains common jobs for WAR mojos.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringExpression preceded with this String won't be interpolated.protected BooleanWhether to fail the build if theweb.xmlfile is missing.protected StringTimestamp for reproducible output archive entries, either formatted as ISO 8601yyyy-MM-dd'T'HH:mm:ssXXXor as an int representing seconds since the epoch (like SOURCE_DATE_EPOCH).protected StringThe character encoding to use when reading and writing filtered properties files.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractWarMojo(org.codehaus.plexus.archiver.jar.JarArchiver jarArchiver, org.apache.maven.artifact.factory.ArtifactFactory artifactFactory, org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager, org.apache.maven.shared.filtering.MavenFileFilter mavenFileFilter, org.apache.maven.shared.filtering.MavenResourcesFiltering mavenResourcesFiltering) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddOverlay(Overlay overlay) voidbuildExplodedWebapp(File webapplicationDirectory) voidbuildWebapp(org.apache.maven.project.MavenProject mavenProject, File webapplicationDirectory) Builds the webapp for the specified project with the new packaging task thingy.org.apache.maven.archiver.MavenArchiveConfigurationorg.apache.maven.artifact.factory.ArtifactFactoryprotected String[]Returns a string array of the excludes to be used when adding dependent WAR as an overlay onto this WAR.protected String[]Returns a string array of the includes to be used when adding dependent WARs as an overlay onto this WAR.protected String[]Returns a string array of the excludes to be used when copying the content of the WAR source directory.protected String[]Returns a string array of the includes to be used when assembling/copying the WAR.org.codehaus.plexus.archiver.jar.JarArchiverString[]String[]org.apache.maven.project.MavenProjectprotected org.apache.maven.execution.MavenSessionorg.apache.maven.model.Resource[]booleanprotected booleanprotected booleanvoidsetClassesDirectory(File classesDirectory) voidsetContainerConfigXML(File containerConfigXML) voidsetOutputFileNameMapping(String outputFileNameMapping) voidsetOverlays(List<Overlay> overlays) voidsetPackagingExcludes(String packagingExcludes) voidsetPackagingIncludes(String packagingIncludes) voidsetProject(org.apache.maven.project.MavenProject project) voidsetWarSourceDirectory(File warSourceDirectory) voidsetWebappDirectory(File webappDirectory) voidsetWebResources(org.apache.maven.model.Resource[] webResources) voidMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.maven.plugin.Mojo
execute
-
Field Details
-
failOnMissingWebXml
Whether to fail the build if theweb.xmlfile is missing. Set tofalseif you want your WAR built without aweb.xmlfile. This may be useful if you are building an overlay that has no web.xml file.Starting with 3.1.0, this property defaults to
falseif the project depends on the Servlet 3.0 API or newer.- Since:
- 2.1-alpha-2
-
propertiesEncoding
The character encoding to use when reading and writing filtered properties files. If not specified, it will default to the value of the "resourceEncoding" parameter.- Since:
- 3.4.0
-
escapeString
Expression preceded with this String won't be interpolated.\${foo}will be replaced with${foo}.- Since:
- 2.1-beta-1
-
outputTimestamp
Timestamp for reproducible output archive entries, either formatted as ISO 8601yyyy-MM-dd'T'HH:mm:ssXXXor as an int representing seconds since the epoch (like SOURCE_DATE_EPOCH).- Since:
- 3.3.0
-
-
Constructor Details
-
Method Details
-
getCurrentProjectOverlay
- Returns:
- The current overlay.
-
getExcludes
Returns a string array of the excludes to be used when copying the content of the WAR source directory.- Returns:
- an array of tokens to exclude
-
getIncludes
Returns a string array of the includes to be used when assembling/copying the WAR.- Returns:
- an array of tokens to include
-
getDependentWarExcludes
Returns a string array of the excludes to be used when adding dependent WAR as an overlay onto this WAR.- Returns:
- an array of tokens to exclude
-
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(File webapplicationDirectory) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException - Parameters:
webapplicationDirectory- The web application directory.- Throws:
org.apache.maven.plugin.MojoExecutionException- In case of failure.org.apache.maven.plugin.MojoFailureException- In case of failure.
-
buildWebapp
public void buildWebapp(org.apache.maven.project.MavenProject mavenProject, File webapplicationDirectory) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException, IOException Builds the webapp for the specified project with the new packaging task thingy. Classes, libraries and tld files are copied to thewebappDirectoryduring this phase.- Parameters:
mavenProject- the maven projectwebapplicationDirectory- the target directory- Throws:
org.apache.maven.plugin.MojoExecutionException- if an error occurred while packaging the webapporg.apache.maven.plugin.MojoFailureException- if an unexpected error occurred while packaging the webappIOException- if an error occurred while copying the files
-
getProject
public org.apache.maven.project.MavenProject getProject()- Returns:
- The Maven Project.
-
setProject
public void setProject(org.apache.maven.project.MavenProject project) - Parameters:
project- The project to be set.
-
getClassesDirectory
- Returns:
- the classes directory.
-
setClassesDirectory
- Parameters:
classesDirectory- The classes directory to be set.
-
getWebappDirectory
- Returns:
webappDirectory
-
setWebappDirectory
- Parameters:
webappDirectory- The web application directory.
-
getWarSourceDirectory
- Returns:
warSourceDirectory
-
setWarSourceDirectory
- Parameters:
warSourceDirectory-warSourceDirectory
-
getWebXml
- Returns:
- The
webXml
-
setWebXml
- Parameters:
webXml- ThewebXml
-
getContainerConfigXML
- Returns:
containerConfigXML
-
setContainerConfigXML
- Parameters:
containerConfigXML-containerConfigXML
-
getOutputFileNameMapping
- Returns:
outputFileNameMapping
-
setOutputFileNameMapping
- Parameters:
outputFileNameMapping-outputFileNameMapping
-
getOverlays
- Returns:
overlays
-
setOverlays
- Parameters:
overlays-overlays
-
addOverlay
- Parameters:
overlay- addoverlays.
-
isArchiveClasses
public boolean isArchiveClasses()- Returns:
archiveClasses
-
getJarArchiver
public org.codehaus.plexus.archiver.jar.JarArchiver getJarArchiver()- Returns:
JarArchiver
-
getWebResources
public org.apache.maven.model.Resource[] getWebResources()- Returns:
webResources.
-
setWebResources
public void setWebResources(org.apache.maven.model.Resource[] webResources) - Parameters:
webResources-webResources.
-
getFilters
- Returns:
filters
-
getWorkDirectory
- Returns:
workDirectory
-
getWarSourceIncludes
- Returns:
warSourceIncludes
-
getWarSourceExcludes
- Returns:
warSourceExcludes
-
getArchive
public org.apache.maven.archiver.MavenArchiveConfiguration getArchive()- Returns:
archive
-
getNonFilteredFileExtensions
- Returns:
nonFilteredFileExtensions
-
getArtifactFactory
public org.apache.maven.artifact.factory.ArtifactFactory getArtifactFactory()- Returns:
artifactFactory
-
getSession
protected org.apache.maven.execution.MavenSession getSession()- Returns:
session
-
isRecompressZippedFiles
protected boolean isRecompressZippedFiles()- Returns:
recompressZippedFiles
-
isIncludeEmptyDirectories
protected boolean isIncludeEmptyDirectories()- Returns:
includeEmptyDirectories
-
getPackagingExcludes
- Returns:
- The package excludes.
-
setPackagingExcludes
- Parameters:
packagingExcludes-packagingExcludes
-
getPackagingIncludes
- Returns:
- The packaging includes.
-
setPackagingIncludes
- Parameters:
packagingIncludes-packagingIncludes
-