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 Object
implements WarPackagingContext
WarPackagingContext default implementation
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.apache.maven.artifact.factory.ArtifactFactory
private final Boolean
private boolean
private final List
<org.apache.maven.shared.filtering.FilterWrapper> private final Collection
<String> private final String
private final OverlayManager
private final String
private final String
private boolean
private final File
private final WebappStructure
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultWarPackagingContext
(File webappDirectory, WebappStructure webappStructure, OverlayManager overlayManager, List<org.apache.maven.shared.filtering.FilterWrapper> filterWrappers, List<String> nonFilteredFileExtensions, boolean filteringDeploymentDescriptors, org.apache.maven.artifact.factory.ArtifactFactory artifactFactory, String resourceEncoding, String propertiesEncoding, boolean useJvmChmod, Boolean failOnMissingWebXml, String outputTimestamp) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addResource
(String resource) Add a live resource to the war.boolean
Specify whether the classes resources should be archived in theWEB-INF/lib
of the generated web app.protected boolean
void
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
The maven archive configuration to use.org.codehaus.plexus.archiver.manager.ArchiverManager
Returns the archiver manager to use.org.apache.maven.artifact.factory.ArtifactFactory
Returns the directory holding generated classes.Returns the list of filter files to use.List
<org.apache.maven.shared.filtering.FilterWrapper> org.codehaus.plexus.archiver.jar.JarArchiver
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
Returns theMavenFileFilter
instance to use.Returns the output file name mapping to use, if any.Output timestamp for reproducible archive creation.Returns the directory to unpack dependent WARs into if needed.Returns the list of registered overlays for this session.org.apache.maven.project.MavenProject
Returns the maven project.Returns the encoding to use for resources that are properties files.Returns the encoding to use for resources.org.apache.maven.execution.MavenSession
Returns the Maven session.Returns the webapp directory.Returns the main webapp source directory.String[]
Returns the webapp source excludes.String[]
Returns the webapp source includes.Returns theWebappStructure
.Returns the flag that switch on/off the missing web.xml validationboolean
boolean
isNonFilteredExtension
(String fileName) Specify if the givenfileName
belongs to the list of extensions that must not be filteredboolean
boolean
Returnstrue
if empty directories should be includes, otherwisefalse
-
Field Details
-
artifactFactory
private final org.apache.maven.artifact.factory.ArtifactFactory artifactFactory -
resourceEncoding
-
propertiesEncoding
-
webappStructure
-
webappDirectory
-
overlayManager
-
filterWrappers
-
nonFilteredFileExtensions
-
filteringDeploymentDescriptors
private boolean filteringDeploymentDescriptors -
useJvmChmod
private boolean useJvmChmod -
failOnMissingWebXml
-
outdatedResources
-
outputTimestamp
-
-
Constructor Details
-
DefaultWarPackagingContext
DefaultWarPackagingContext(File webappDirectory, WebappStructure webappStructure, OverlayManager overlayManager, List<org.apache.maven.shared.filtering.FilterWrapper> filterWrappers, List<String> nonFilteredFileExtensions, boolean filteringDeploymentDescriptors, org.apache.maven.artifact.factory.ArtifactFactory artifactFactory, String resourceEncoding, String propertiesEncoding, boolean useJvmChmod, Boolean failOnMissingWebXml, 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 Details
-
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
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
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
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
Description copied from interface:WarPackagingContext
Returns the main webapp source directory.- Specified by:
getWebappSourceDirectory
in interfaceWarPackagingContext
- Returns:
- the webapp source directory
-
getWebappSourceIncludes
Description copied from interface:WarPackagingContext
Returns the webapp source includes.- Specified by:
getWebappSourceIncludes
in interfaceWarPackagingContext
- Returns:
- the webapp source includes
-
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
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
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
Description copied from interface:WarPackagingContext
Returns theWebappStructure
.- Specified by:
getWebappStructure
in interfaceWarPackagingContext
- Returns:
- the webapp structure
-
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
- Specified by:
getFilterWrappers
in interfaceWarPackagingContext
- Returns:
List
ofFilterWrapper
-
isNonFilteredExtension
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
Description copied from interface:WarPackagingContext
Returns the encoding to use for resources.- Specified by:
getResourceEncoding
in interfaceWarPackagingContext
- Returns:
- the resource encoding
-
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
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
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:
-
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:
-
getOutputTimestamp
Description copied from interface:WarPackagingContext
Output timestamp for reproducible archive creation.- Specified by:
getOutputTimestamp
in interfaceWarPackagingContext
- Returns:
- the output timestamp (may be null)
-