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.handler.manager.ArtifactHandlerManagerartifactHandlerManagerprivate java.lang.BooleanfailOnMissingWebXmlprivate booleanfilteringDeploymentDescriptorsprivate java.util.List<org.apache.maven.shared.filtering.FilterWrapper>filterWrappersprivate java.util.List<java.lang.String>nonFilteredFileExtensionsprivate java.util.Collection<java.lang.String>outdatedResourcesprivate java.lang.StringoutputTimestampprivate OverlayManageroverlayManagerprivate java.lang.StringpropertiesEncodingprivate java.lang.StringresourceEncodingprivate java.io.FilewebappDirectoryprivate WebappStructurewebappStructure
-
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.handler.manager.ArtifactHandlerManager artifactHandlerManager, java.lang.String resourceEncoding, java.lang.String propertiesEncoding, java.lang.Boolean failOnMissingWebXml, java.lang.String outputTimestamp)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddResource(java.lang.String resource)Add a live resource to the war.booleanarchiveClasses()Specify whether the classes resources should be archived in theWEB-INF/libof the generated web app.protected booleancheckAllPathsForOutdated()voiddeleteOutdatedResources()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.MavenArchiveConfigurationgetArchive()The maven archive configuration to use.org.codehaus.plexus.archiver.manager.ArchiverManagergetArchiverManager()Returns the archiver manager to use.org.apache.maven.artifact.handler.manager.ArtifactHandlerManagergetArtifactHandlerManager()Returns the artifact handler manager.java.io.FilegetClassesDirectory()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.JarArchivergetJarArchiver()Returns 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.MavenFileFiltergetMavenFileFilter()Returns theMavenFileFilterinstance to use.java.lang.StringgetOutputFileNameMapping()Returns the output file name mapping to use, if any.java.lang.StringgetOutputTimestamp()Output timestamp for reproducible archive creation.java.io.FilegetOverlaysWorkDirectory()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.java.util.List<java.lang.String>getPackagingExcludes()java.util.List<java.lang.String>getPackagingIncludes()org.apache.maven.project.MavenProjectgetProject()Returns the maven project.java.lang.StringgetPropertiesEncoding()Returns the encoding to use for resources that are properties files.java.lang.StringgetResourceEncoding()Returns the encoding to use for resources.org.apache.maven.execution.MavenSessiongetSession()Returns the Maven session.java.io.FilegetWebappDirectory()Returns the webapp directory.java.io.FilegetWebappSourceDirectory()Returns the main webapp source directory.java.lang.String[]getWebappSourceExcludes()Returns the webapp source excludes.java.lang.String[]getWebappSourceIncludes()Returns the webapp source includes.WebappStructuregetWebappStructure()Returns theWebappStructure.java.lang.BooleanisFailOnMissingWebXml()Returns the flag that switch on/off the missing web.xml validation.booleanisFilteringDeploymentDescriptors()booleanisNonFilteredExtension(java.lang.String fileName)Specify if the givenfileNamebelongs to the list of extensions that must not be filtered.booleanisWebappSourceIncludeEmptyDirectories()Returnstrueif empty directories should be includes, otherwisefalse
-
-
-
Field Detail
-
artifactHandlerManager
private final org.apache.maven.artifact.handler.manager.ArtifactHandlerManager artifactHandlerManager
-
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
-
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.handler.manager.ArtifactHandlerManager artifactHandlerManager, java.lang.String resourceEncoding, java.lang.String propertiesEncoding, java.lang.Boolean failOnMissingWebXml, java.lang.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 Detail
-
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
public java.io.File 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
public java.io.File 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
public java.lang.String 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
public java.io.File getWebappSourceDirectory()
Description copied from interface:WarPackagingContextReturns the main webapp source directory.- Specified by:
getWebappSourceDirectoryin interfaceWarPackagingContext- Returns:
- the webapp source directory
-
getWebappSourceIncludes
public java.lang.String[] getWebappSourceIncludes()
Description copied from interface:WarPackagingContextReturns the webapp source includes.- Specified by:
getWebappSourceIncludesin interfaceWarPackagingContext- Returns:
- the webapp source includes
-
getWebappSourceExcludes
public java.lang.String[] 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
public java.io.File 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
public java.util.List<java.lang.String> getFilters()
Description copied from interface:WarPackagingContextReturns the list of filter files to use.- Specified by:
getFiltersin interfaceWarPackagingContext- Returns:
- a list of filter files
-
getWebappStructure
public WebappStructure getWebappStructure()
Description copied from interface:WarPackagingContextReturns theWebappStructure.- Specified by:
getWebappStructurein interfaceWarPackagingContext- Returns:
- the webapp structure
-
getOwnerIds
public java.util.List<java.lang.String> 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
public java.util.List<org.apache.maven.shared.filtering.FilterWrapper> getFilterWrappers()
- Specified by:
getFilterWrappersin interfaceWarPackagingContext- Returns:
ListofFilterWrapper
-
isNonFilteredExtension
public boolean isNonFilteredExtension(java.lang.String fileName)
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
public java.lang.String getResourceEncoding()
Description copied from interface:WarPackagingContextReturns the encoding to use for resources.- Specified by:
getResourceEncodingin interfaceWarPackagingContext- Returns:
- the resource encoding
-
getPropertiesEncoding
public java.lang.String 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
public java.lang.Boolean isFailOnMissingWebXml()
Description copied from interface:WarPackagingContextReturns the flag that switch on/off the missing web.xml validation.- Specified by:
isFailOnMissingWebXmlin interfaceWarPackagingContext- Returns:
- failOnMissingWebXml
-
addResource
public void addResource(java.lang.String resource)
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:
WarPackagingContext.deleteOutdatedResources()
-
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:
WarPackagingContext.addResource(java.lang.String)
-
getOutputTimestamp
public java.lang.String getOutputTimestamp()
Description copied from interface:WarPackagingContextOutput timestamp for reproducible archive creation.- Specified by:
getOutputTimestampin interfaceWarPackagingContext- Returns:
- the output timestamp (may be null)
-
getPackagingExcludes
public java.util.List<java.lang.String> getPackagingExcludes()
- Specified by:
getPackagingExcludesin interfaceWarPackagingContext- Returns:
- list of packaging excludes
- Since:
- 3.4.1
-
getPackagingIncludes
public java.util.List<java.lang.String> getPackagingIncludes()
- Specified by:
getPackagingIncludesin interfaceWarPackagingContext- Returns:
- list of packaging includes
- Since:
- 3.4.1
-
-