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.handler.manager.ArtifactHandlerManagerprivate final Booleanprivate booleanprivate final List<org.apache.maven.shared.filtering.FilterWrapper> private final Collection<String> private final Stringprivate final OverlayManagerprivate final Stringprivate final Stringprivate final Fileprivate 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.handler.manager.ArtifactHandlerManager artifactHandlerManager, String resourceEncoding, String propertiesEncoding, Boolean failOnMissingWebXml, String outputTimestamp) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddResource(String resource) Add a live resource to the war.booleanSpecify whether the classes resources should be archived in theWEB-INF/libof the generated web app.protected booleanvoidDelete 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.MavenArchiveConfigurationThe maven archive configuration to use.org.codehaus.plexus.archiver.manager.ArchiverManagerReturns the archiver manager to use.org.apache.maven.artifact.handler.manager.ArtifactHandlerManagerReturns the artifact handler manager.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.JarArchiverReturns the Jar archiver needed for archiving classes directory into jar file under WEB-INF/lib.org.apache.maven.plugin.logging.LoggetLog()Returns the logger to use to output logging event.org.apache.maven.shared.filtering.MavenFileFilterReturns theMavenFileFilterinstance 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.MavenProjectReturns 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.MavenSessionReturns 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 validation.booleanbooleanisNonFilteredExtension(String fileName) Specify if the givenfileNamebelongs to the list of extensions that must not be filtered.booleanReturnstrueif empty directories should be includes, otherwisefalse
-
Field Details
-
artifactHandlerManager
private final org.apache.maven.artifact.handler.manager.ArtifactHandlerManager artifactHandlerManager -
resourceEncoding
-
propertiesEncoding
-
webappStructure
-
webappDirectory
-
overlayManager
-
filterWrappers
-
nonFilteredFileExtensions
-
filteringDeploymentDescriptors
private boolean filteringDeploymentDescriptors -
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.handler.manager.ArtifactHandlerManager artifactHandlerManager, String resourceEncoding, String propertiesEncoding, Boolean failOnMissingWebXml, String outputTimestamp) - Parameters:
webappDirectory- the web application directorywebappStructure- the web app structureoverlayManager- the overlay managerfilterWrappers- the filter wrappersnonFilteredFileExtensions- the non filtered file extensionsfilteringDeploymentDescriptors- the filtering deployment descriptorsartifactHandlerManager- the artifact handler managerresourceEncoding- the resource encodingpropertiesEncoding- the encoding to use for properties filesfailOnMissingWebXml- 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:WarPackagingContextReturns the maven project.- Specified by:
getProjectin interfaceWarPackagingContext- Returns:
- the project
-
getWebappDirectory
Description copied from interface:WarPackagingContextReturns the webapp directory. Packaging tasks should use this directory to generate the webapp.- Specified by:
getWebappDirectoryin interfaceWarPackagingContext- Returns:
- the webapp directory
-
getClassesDirectory
Description copied from interface:WarPackagingContextReturns the directory holding generated classes.- Specified by:
getClassesDirectoryin interfaceWarPackagingContext- Returns:
- the classes directory
-
getLog
public org.apache.maven.plugin.logging.Log getLog()Description copied from interface:WarPackagingContextReturns the logger to use to output logging event.- Specified by:
getLogin interfaceWarPackagingContext- Returns:
- the logger
-
getOutputFileNameMapping
Description copied from interface:WarPackagingContextReturns the output file name mapping to use, if any. Returnsnullif no file name mapping is set.- Specified by:
getOutputFileNameMappingin interfaceWarPackagingContext- Returns:
- the output file name mapping or
null
-
getWebappSourceDirectory
Description copied from interface:WarPackagingContextReturns the main webapp source directory.- Specified by:
getWebappSourceDirectoryin interfaceWarPackagingContext- Returns:
- the webapp source directory
-
getWebappSourceIncludes
Description copied from interface:WarPackagingContextReturns the webapp source includes.- Specified by:
getWebappSourceIncludesin interfaceWarPackagingContext- Returns:
- the webapp source includes
-
getWebappSourceExcludes
Description copied from interface:WarPackagingContextReturns the webapp source excludes.- Specified by:
getWebappSourceExcludesin interfaceWarPackagingContext- Returns:
- the webapp source excludes
-
isWebappSourceIncludeEmptyDirectories
public boolean isWebappSourceIncludeEmptyDirectories()Description copied from interface:WarPackagingContextReturnstrueif empty directories should be includes, otherwisefalse- Specified by:
isWebappSourceIncludeEmptyDirectoriesin interfaceWarPackagingContext- Returns:
trueif empty directories should be includes, otherwisefalse
-
archiveClasses
public boolean archiveClasses()Description copied from interface:WarPackagingContextSpecify whether the classes resources should be archived in theWEB-INF/libof the generated web app.- Specified by:
archiveClassesin interfaceWarPackagingContext- Returns:
- true if the classes should be archived, false otherwise
-
getOverlaysWorkDirectory
Description copied from interface:WarPackagingContextReturns the directory to unpack dependent WARs into if needed.- Specified by:
getOverlaysWorkDirectoryin interfaceWarPackagingContext- Returns:
- the overlays work directory
-
getArchiverManager
public org.codehaus.plexus.archiver.manager.ArchiverManager getArchiverManager()Description copied from interface:WarPackagingContextReturns the archiver manager to use.- Specified by:
getArchiverManagerin interfaceWarPackagingContext- Returns:
- the archiver manager
-
getArchive
public org.apache.maven.archiver.MavenArchiveConfiguration getArchive()Description copied from interface:WarPackagingContextThe maven archive configuration to use.- Specified by:
getArchivein interfaceWarPackagingContext- Returns:
- the maven archive configuration
-
getJarArchiver
public org.codehaus.plexus.archiver.jar.JarArchiver getJarArchiver()Description copied from interface:WarPackagingContextReturns the Jar archiver needed for archiving classes directory into jar file under WEB-INF/lib.- Specified by:
getJarArchiverin interfaceWarPackagingContext- Returns:
- the jar archiver to user
-
getFilters
Description copied from interface:WarPackagingContextReturns the list of filter files to use.- Specified by:
getFiltersin interfaceWarPackagingContext- Returns:
- a list of filter files
-
getWebappStructure
Description copied from interface:WarPackagingContextReturns theWebappStructure.- Specified by:
getWebappStructurein interfaceWarPackagingContext- Returns:
- the webapp structure
-
getOwnerIds
Description copied from interface:WarPackagingContextReturns the list of registered overlays for this session.- Specified by:
getOwnerIdsin interfaceWarPackagingContext- Returns:
- the list of registered overlays, including the current project
-
getMavenFileFilter
public org.apache.maven.shared.filtering.MavenFileFilter getMavenFileFilter()Description copied from interface:WarPackagingContextReturns theMavenFileFilterinstance to use.- Specified by:
getMavenFileFilterin interfaceWarPackagingContext- Returns:
- the maven file filter to use
-
getFilterWrappers
- Specified by:
getFilterWrappersin interfaceWarPackagingContext- Returns:
ListofFilterWrapper
-
isNonFilteredExtension
Description copied from interface:WarPackagingContextSpecify if the givenfileNamebelongs to the list of extensions that must not be filtered.- Specified by:
isNonFilteredExtensionin interfaceWarPackagingContext- Parameters:
fileName- the name of file- Returns:
trueif it should not be filtered,falseotherwise
-
isFilteringDeploymentDescriptors
public boolean isFilteringDeploymentDescriptors()- Specified by:
isFilteringDeploymentDescriptorsin interfaceWarPackagingContext- Returns:
- filtering deployment descriptor
-
getArtifactHandlerManager
public org.apache.maven.artifact.handler.manager.ArtifactHandlerManager getArtifactHandlerManager()Description copied from interface:WarPackagingContextReturns the artifact handler manager.- Specified by:
getArtifactHandlerManagerin interfaceWarPackagingContext- Returns:
- the artifact handler manager
-
getSession
public org.apache.maven.execution.MavenSession getSession()Description copied from interface:WarPackagingContextReturns the Maven session.- Specified by:
getSessionin interfaceWarPackagingContext- Returns:
- the Maven session
-
getResourceEncoding
Description copied from interface:WarPackagingContextReturns the encoding to use for resources.- Specified by:
getResourceEncodingin interfaceWarPackagingContext- Returns:
- the resource encoding
-
getPropertiesEncoding
Description copied from interface:WarPackagingContextReturns the encoding to use for resources that are properties files.- Specified by:
getPropertiesEncodingin interfaceWarPackagingContext- Returns:
- the encoding for properties files
-
isFailOnMissingWebXml
Description copied from interface:WarPackagingContextReturns the flag that switch on/off the missing web.xml validation.- Specified by:
isFailOnMissingWebXmlin interfaceWarPackagingContext- Returns:
- failOnMissingWebXml
-
addResource
Description copied from interface:WarPackagingContextAdd 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 cleanwhen resources are removed.- Specified by:
addResourcein interfaceWarPackagingContext- Parameters:
resource- the resource that is to me marked as not outdated- See Also:
-
deleteOutdatedResources
public void deleteOutdatedResources()Description copied from interface:WarPackagingContextDelete 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 cleanwhen resources are removed.- Specified by:
deleteOutdatedResourcesin interfaceWarPackagingContext- See Also:
-
getOutputTimestamp
Description copied from interface:WarPackagingContextOutput timestamp for reproducible archive creation.- Specified by:
getOutputTimestampin interfaceWarPackagingContext- Returns:
- the output timestamp (may be null)
-
getPackagingExcludes
- Specified by:
getPackagingExcludesin interfaceWarPackagingContext- Returns:
- list of packaging excludes
- Since:
- 3.4.1
-
getPackagingIncludes
- Specified by:
getPackagingIncludesin interfaceWarPackagingContext- Returns:
- list of packaging includes
- Since:
- 3.4.1
-