Package org.apache.maven.plugins.war
Class AbstractWarMojo.DefaultWarPackagingContext
- java.lang.Object
-
- org.apache.maven.plugins.war.AbstractWarMojo.DefaultWarPackagingContext
-
- All Implemented Interfaces:
WarPackagingContext
- Enclosing class:
- AbstractWarMojo
private class AbstractWarMojo.DefaultWarPackagingContext extends java.lang.Object implements WarPackagingContext
WarPackagingContext default implementation
-
-
Field Summary
Fields Modifier and Type Field Description private org.apache.maven.artifact.factory.ArtifactFactory
artifactFactory
private java.lang.Boolean
failOnMissingWebXml
private boolean
filteringDeploymentDescriptors
private java.util.List<org.apache.maven.shared.filtering.FilterWrapper>
filterWrappers
private java.util.List<java.lang.String>
nonFilteredFileExtensions
private java.util.Collection<java.lang.String>
outdatedResources
private java.lang.String
outputTimestamp
private OverlayManager
overlayManager
private java.lang.String
propertiesEncoding
private java.lang.String
resourceEncoding
private boolean
useJvmChmod
private java.io.File
webappDirectory
private WebappStructure
webappStructure
-
Constructor Summary
Constructors Constructor Description DefaultWarPackagingContext(java.io.File webappDirectory, WebappStructure webappStructure, OverlayManager overlayManager, java.util.List<org.apache.maven.shared.filtering.FilterWrapper> filterWrappers, java.util.List<java.lang.String> nonFilteredFileExtensions, boolean filteringDeploymentDescriptors, org.apache.maven.artifact.factory.ArtifactFactory artifactFactory, java.lang.String resourceEncoding, java.lang.String propertiesEncoding, boolean useJvmChmod, java.lang.Boolean failOnMissingWebXml, java.lang.String outputTimestamp)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addResource(java.lang.String resource)
Add a live resource to the war.boolean
archiveClasses()
Specify whether the classes resources should be archived in theWEB-INF/lib
of the generated web app.protected boolean
checkAllPathsForOutdated()
void
deleteOutdatedResources()
Delete outdated resources, ie resources that are found in the war but that were not added by the current packaging process, then are supposed to be content from a previous run.org.apache.maven.archiver.MavenArchiveConfiguration
getArchive()
The maven archive configuration to use.org.codehaus.plexus.archiver.manager.ArchiverManager
getArchiverManager()
Returns the archiver manager to use.org.apache.maven.artifact.factory.ArtifactFactory
getArtifactFactory()
java.io.File
getClassesDirectory()
Returns the directory holding generated classes.java.util.List<java.lang.String>
getFilters()
Returns the list of filter files to use.java.util.List<org.apache.maven.shared.filtering.FilterWrapper>
getFilterWrappers()
org.codehaus.plexus.archiver.jar.JarArchiver
getJarArchiver()
Returns the Jar archiver needed for archiving classes directory into jar file under WEB-INF/lib.org.apache.maven.plugin.logging.Log
getLog()
Returns the logger to use to output logging event.org.apache.maven.shared.filtering.MavenFileFilter
getMavenFileFilter()
Returns theMavenFileFilter
instance to use.java.lang.String
getOutputFileNameMapping()
Returns the output file name mapping to use, if any.java.lang.String
getOutputTimestamp()
Output timestamp for reproducible archive creation.java.io.File
getOverlaysWorkDirectory()
Returns the directory to unpack dependent WARs into if needed.java.util.List<java.lang.String>
getOwnerIds()
Returns the list of registered overlays for this session.org.apache.maven.project.MavenProject
getProject()
Returns the maven project.java.lang.String
getPropertiesEncoding()
Returns the encoding to use for resources that are properties files.java.lang.String
getResourceEncoding()
Returns the encoding to use for resources.org.apache.maven.execution.MavenSession
getSession()
Returns the Maven session.java.io.File
getWebappDirectory()
Returns the webapp directory.java.io.File
getWebappSourceDirectory()
Returns the main webapp source directory.java.lang.String[]
getWebappSourceExcludes()
Returns the webapp source excludes.java.lang.String[]
getWebappSourceIncludes()
Returns the webapp source includes.WebappStructure
getWebappStructure()
Returns theWebappStructure
.java.lang.Boolean
isFailOnMissingWebXml()
Returns the flag that switch on/off the missing web.xml validationboolean
isFilteringDeploymentDescriptors()
boolean
isNonFilteredExtension(java.lang.String fileName)
Specify if the givenfileName
belongs to the list of extensions that must not be filteredboolean
isUseJvmChmod()
boolean
isWebappSourceIncludeEmptyDirectories()
Returnstrue
if empty directories should be includes, otherwisefalse
-
-
-
Field Detail
-
artifactFactory
private final org.apache.maven.artifact.factory.ArtifactFactory artifactFactory
-
resourceEncoding
private final java.lang.String resourceEncoding
-
propertiesEncoding
private final java.lang.String propertiesEncoding
-
webappStructure
private final WebappStructure webappStructure
-
webappDirectory
private final java.io.File webappDirectory
-
overlayManager
private final OverlayManager overlayManager
-
filterWrappers
private final java.util.List<org.apache.maven.shared.filtering.FilterWrapper> filterWrappers
-
nonFilteredFileExtensions
private java.util.List<java.lang.String> nonFilteredFileExtensions
-
filteringDeploymentDescriptors
private boolean filteringDeploymentDescriptors
-
useJvmChmod
private boolean useJvmChmod
-
failOnMissingWebXml
private final java.lang.Boolean failOnMissingWebXml
-
outdatedResources
private final java.util.Collection<java.lang.String> outdatedResources
-
outputTimestamp
private final java.lang.String outputTimestamp
-
-
Constructor Detail
-
DefaultWarPackagingContext
DefaultWarPackagingContext(java.io.File webappDirectory, WebappStructure webappStructure, OverlayManager overlayManager, java.util.List<org.apache.maven.shared.filtering.FilterWrapper> filterWrappers, java.util.List<java.lang.String> nonFilteredFileExtensions, boolean filteringDeploymentDescriptors, org.apache.maven.artifact.factory.ArtifactFactory artifactFactory, java.lang.String resourceEncoding, java.lang.String propertiesEncoding, boolean useJvmChmod, java.lang.Boolean failOnMissingWebXml, java.lang.String outputTimestamp)
- Parameters:
webappDirectory
- The web application directory.webappStructure
- The web app structure.overlayManager
- The overlay manager.filterWrappers
- The filter wrappersnonFilteredFileExtensions
- The non filtered file extensions.filteringDeploymentDescriptors
- The filtering deployment descriptors.artifactFactory
- The artifact factory.resourceEncoding
- The resource encoding.propertiesEncoding
- The encoding to use for properties files.useJvmChmod
- use Jvm chmod or not.failOnMissingWebXml
- Flag to check whether we should ignore missing web.xml or notoutputTimestamp
- the output timestamp for reproducible archive creation
-
-
Method Detail
-
checkAllPathsForOutdated
protected boolean checkAllPathsForOutdated()
-
getProject
public org.apache.maven.project.MavenProject getProject()
Description copied from interface:WarPackagingContext
Returns the maven project.- Specified by:
getProject
in interfaceWarPackagingContext
- Returns:
- the project
-
getWebappDirectory
public java.io.File getWebappDirectory()
Description copied from interface:WarPackagingContext
Returns the webapp directory. Packaging tasks should use this directory to generate the webapp.- Specified by:
getWebappDirectory
in interfaceWarPackagingContext
- Returns:
- the webapp directory
-
getClassesDirectory
public java.io.File getClassesDirectory()
Description copied from interface:WarPackagingContext
Returns the directory holding generated classes.- Specified by:
getClassesDirectory
in interfaceWarPackagingContext
- Returns:
- the classes directory
-
getLog
public org.apache.maven.plugin.logging.Log getLog()
Description copied from interface:WarPackagingContext
Returns the logger to use to output logging event.- Specified by:
getLog
in interfaceWarPackagingContext
- Returns:
- the logger
-
getOutputFileNameMapping
public java.lang.String getOutputFileNameMapping()
Description copied from interface:WarPackagingContext
Returns the output file name mapping to use, if any. Returnsnull
if no file name mapping is set.- Specified by:
getOutputFileNameMapping
in interfaceWarPackagingContext
- Returns:
- the output file name mapping or
null
-
getWebappSourceDirectory
public java.io.File getWebappSourceDirectory()
Description copied from interface:WarPackagingContext
Returns the main webapp source directory.- Specified by:
getWebappSourceDirectory
in interfaceWarPackagingContext
- Returns:
- the webapp source directory
-
getWebappSourceIncludes
public java.lang.String[] getWebappSourceIncludes()
Description copied from interface:WarPackagingContext
Returns the webapp source includes.- Specified by:
getWebappSourceIncludes
in interfaceWarPackagingContext
- Returns:
- the webapp source includes
-
getWebappSourceExcludes
public java.lang.String[] getWebappSourceExcludes()
Description copied from interface:WarPackagingContext
Returns the webapp source excludes.- Specified by:
getWebappSourceExcludes
in interfaceWarPackagingContext
- Returns:
- the webapp source excludes
-
isWebappSourceIncludeEmptyDirectories
public boolean isWebappSourceIncludeEmptyDirectories()
Description copied from interface:WarPackagingContext
Returnstrue
if empty directories should be includes, otherwisefalse
- Specified by:
isWebappSourceIncludeEmptyDirectories
in interfaceWarPackagingContext
- Returns:
true
if empty directories should be includes, otherwisefalse
-
archiveClasses
public boolean archiveClasses()
Description copied from interface:WarPackagingContext
Specify whether the classes resources should be archived in theWEB-INF/lib
of the generated web app.- Specified by:
archiveClasses
in interfaceWarPackagingContext
- Returns:
- true if the classes should be archived, false otherwise
-
getOverlaysWorkDirectory
public java.io.File getOverlaysWorkDirectory()
Description copied from interface:WarPackagingContext
Returns the directory to unpack dependent WARs into if needed.- Specified by:
getOverlaysWorkDirectory
in interfaceWarPackagingContext
- Returns:
- the overlays work directory
-
getArchiverManager
public org.codehaus.plexus.archiver.manager.ArchiverManager getArchiverManager()
Description copied from interface:WarPackagingContext
Returns the archiver manager to use.- Specified by:
getArchiverManager
in interfaceWarPackagingContext
- Returns:
- the archiver manager
-
getArchive
public org.apache.maven.archiver.MavenArchiveConfiguration getArchive()
Description copied from interface:WarPackagingContext
The maven archive configuration to use.- Specified by:
getArchive
in interfaceWarPackagingContext
- Returns:
- the maven archive configuration
-
getJarArchiver
public org.codehaus.plexus.archiver.jar.JarArchiver getJarArchiver()
Description copied from interface:WarPackagingContext
Returns the Jar archiver needed for archiving classes directory into jar file under WEB-INF/lib.- Specified by:
getJarArchiver
in interfaceWarPackagingContext
- Returns:
- the jar archiver to user
-
getFilters
public java.util.List<java.lang.String> getFilters()
Description copied from interface:WarPackagingContext
Returns the list of filter files to use.- Specified by:
getFilters
in interfaceWarPackagingContext
- Returns:
- a list of filter files
-
getWebappStructure
public WebappStructure getWebappStructure()
Description copied from interface:WarPackagingContext
Returns theWebappStructure
.- Specified by:
getWebappStructure
in interfaceWarPackagingContext
- Returns:
- the webapp structure
-
getOwnerIds
public java.util.List<java.lang.String> getOwnerIds()
Description copied from interface:WarPackagingContext
Returns the list of registered overlays for this session.- Specified by:
getOwnerIds
in interfaceWarPackagingContext
- Returns:
- the list of registered overlays, including the current project
-
getMavenFileFilter
public org.apache.maven.shared.filtering.MavenFileFilter getMavenFileFilter()
Description copied from interface:WarPackagingContext
Returns theMavenFileFilter
instance to use.- Specified by:
getMavenFileFilter
in interfaceWarPackagingContext
- Returns:
- the maven file filter to use
-
getFilterWrappers
public java.util.List<org.apache.maven.shared.filtering.FilterWrapper> getFilterWrappers()
- Specified by:
getFilterWrappers
in interfaceWarPackagingContext
- Returns:
List
ofFilterWrapper
-
isNonFilteredExtension
public boolean isNonFilteredExtension(java.lang.String fileName)
Description copied from interface:WarPackagingContext
Specify if the givenfileName
belongs to the list of extensions that must not be filtered- Specified by:
isNonFilteredExtension
in interfaceWarPackagingContext
- Parameters:
fileName
- the name of file- Returns:
true
if it should not be filtered,false
otherwise
-
isFilteringDeploymentDescriptors
public boolean isFilteringDeploymentDescriptors()
- Specified by:
isFilteringDeploymentDescriptors
in interfaceWarPackagingContext
- Returns:
- filtering deployment descriptor.
-
getArtifactFactory
public org.apache.maven.artifact.factory.ArtifactFactory getArtifactFactory()
- Specified by:
getArtifactFactory
in interfaceWarPackagingContext
- Returns:
ArtifactFactory
-
getSession
public org.apache.maven.execution.MavenSession getSession()
Description copied from interface:WarPackagingContext
Returns the Maven session.- Specified by:
getSession
in interfaceWarPackagingContext
- Returns:
- the Maven session
-
getResourceEncoding
public java.lang.String getResourceEncoding()
Description copied from interface:WarPackagingContext
Returns the encoding to use for resources.- Specified by:
getResourceEncoding
in interfaceWarPackagingContext
- Returns:
- the resource encoding
-
getPropertiesEncoding
public java.lang.String getPropertiesEncoding()
Description copied from interface:WarPackagingContext
Returns the encoding to use for resources that are properties files.- Specified by:
getPropertiesEncoding
in interfaceWarPackagingContext
- Returns:
- the encoding for properties files
-
isUseJvmChmod
public boolean isUseJvmChmod()
- Specified by:
isUseJvmChmod
in interfaceWarPackagingContext
- Returns:
- to use jvmChmod rather than forking chmod cli
-
isFailOnMissingWebXml
public java.lang.Boolean isFailOnMissingWebXml()
Description copied from interface:WarPackagingContext
Returns the flag that switch on/off the missing web.xml validation- Specified by:
isFailOnMissingWebXml
in interfaceWarPackagingContext
- Returns:
- failOnMissingWebXml
-
addResource
public void addResource(java.lang.String resource)
Description copied from interface:WarPackagingContext
Add a live resource to the war. Used to keep track of existing resources and all copied files. All others are outdated and will be removed. This prevent callingmvn clean
when resources are removed.- Specified by:
addResource
in interfaceWarPackagingContext
- Parameters:
resource
- the resource that is to me marked as not outdated- See Also:
WarPackagingContext.deleteOutdatedResources()
-
deleteOutdatedResources
public void deleteOutdatedResources()
Description copied from interface:WarPackagingContext
Delete outdated resources, ie resources that are found in the war but that were not added by the current packaging process, then are supposed to be content from a previous run. This prevent callingmvn clean
when resources are removed.- Specified by:
deleteOutdatedResources
in interfaceWarPackagingContext
- See Also:
WarPackagingContext.addResource(java.lang.String)
-
getOutputTimestamp
public java.lang.String getOutputTimestamp()
Description copied from interface:WarPackagingContext
Output timestamp for reproducible archive creation.- Specified by:
getOutputTimestamp
in interfaceWarPackagingContext
- Returns:
- the output timestamp (may be null)
-
-