Class WarProjectPackagingTask
- java.lang.Object
-
- org.apache.maven.plugins.war.packaging.AbstractWarPackagingTask
-
- org.apache.maven.plugins.war.packaging.WarProjectPackagingTask
-
- All Implemented Interfaces:
WarPackagingTask
public class WarProjectPackagingTask extends AbstractWarPackagingTask
Handles the project own resources, that is:- The list of web resources, if any
- The content of the webapp directory if it exists
- The custom deployment descriptor(s), if any
- The content of the classes directory if it exists
- The dependencies of the project
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.File
containerConfigXML
private Overlay
currentProjectOverlay
private java.lang.String
id
private org.apache.maven.model.Resource[]
webResources
private java.io.File
webXml
-
Fields inherited from class org.apache.maven.plugins.war.packaging.AbstractWarPackagingTask
CLASSES_PATH, DEFAULT_INCLUDES, LIB_PATH, META_INF_PATH, WEB_INF_PATH
-
-
Constructor Summary
Constructors Constructor Description WarProjectPackagingTask(org.apache.maven.model.Resource[] webResources, java.io.File webXml, java.io.File containerConfigXml, Overlay currentProjectOverlay)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
copyResources(WarPackagingContext context, org.apache.maven.model.Resource resource)
Copies webapp webResources from the specified directory.private java.lang.String[]
getFilesToCopy(org.apache.maven.model.Resource resource)
Returns a list of filenames that should be copied over to the destination directory.protected void
handleArtifacts(WarPackagingContext context)
Handles the webapp artifacts.protected void
handleClassesDirectory(WarPackagingContext context)
Handles the webapp classes.protected void
handleDeploymentDescriptors(WarPackagingContext context, java.io.File webinfDir, java.io.File metainfDir, java.lang.Boolean failOnMissingWebXml)
Handles the deployment descriptors, if specified.protected void
handleWebAppSourceDirectory(WarPackagingContext context)
Handles the webapp sources.protected void
handleWebResources(WarPackagingContext context)
Handles the web resources.void
performPackaging(WarPackagingContext context)
Performs the packaging for the specified task.-
Methods inherited from class org.apache.maven.plugins.war.packaging.AbstractWarPackagingTask
copyFile, copyFile, copyFiles, copyFiles, copyFilteredFile, doUnpack, getArtifactFinalName, getEncoding, getFilesToIncludes, getFilesToIncludes
-
-
-
-
Field Detail
-
webResources
private final org.apache.maven.model.Resource[] webResources
-
webXml
private final java.io.File webXml
-
containerConfigXML
private final java.io.File containerConfigXML
-
id
private final java.lang.String id
-
currentProjectOverlay
private Overlay currentProjectOverlay
-
-
Constructor Detail
-
WarProjectPackagingTask
public WarProjectPackagingTask(org.apache.maven.model.Resource[] webResources, java.io.File webXml, java.io.File containerConfigXml, Overlay currentProjectOverlay)
- Parameters:
webResources
-webResources
webXml
-webXml
containerConfigXml
-containerConfigXML
currentProjectOverlay
-currentProjectOverlay
-
-
Method Detail
-
performPackaging
public void performPackaging(WarPackagingContext context) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
Description copied from interface:WarPackagingTask
Performs the packaging for the specified task. The task is responsible to update the packaging context, namely with the files that have been copied.- Parameters:
context
- the packaging context- Throws:
org.apache.maven.plugin.MojoExecutionException
- if an error occurredorg.apache.maven.plugin.MojoFailureException
- if the project configuration is invalid
-
handleWebResources
protected void handleWebResources(WarPackagingContext context) throws org.apache.maven.plugin.MojoExecutionException
Handles the web resources.- Parameters:
context
- the packaging context- Throws:
org.apache.maven.plugin.MojoExecutionException
- if a resource could not be copied
-
handleWebAppSourceDirectory
protected void handleWebAppSourceDirectory(WarPackagingContext context) throws org.apache.maven.plugin.MojoExecutionException
Handles the webapp sources.- Parameters:
context
- the packaging context- Throws:
org.apache.maven.plugin.MojoExecutionException
- if the sources could not be copied
-
handleArtifacts
protected void handleArtifacts(WarPackagingContext context) throws org.apache.maven.plugin.MojoExecutionException
Handles the webapp artifacts.- Parameters:
context
- the packaging context- Throws:
org.apache.maven.plugin.MojoExecutionException
- if the artifacts could not be packaged
-
handleClassesDirectory
protected void handleClassesDirectory(WarPackagingContext context) throws org.apache.maven.plugin.MojoExecutionException
Handles the webapp classes.- Parameters:
context
- the packaging context- Throws:
org.apache.maven.plugin.MojoExecutionException
- if the classes could not be packaged
-
handleDeploymentDescriptors
protected void handleDeploymentDescriptors(WarPackagingContext context, java.io.File webinfDir, java.io.File metainfDir, java.lang.Boolean failOnMissingWebXml) throws org.apache.maven.plugin.MojoFailureException, org.apache.maven.plugin.MojoExecutionException
Handles the deployment descriptors, if specified. Note that the behavior here is slightly different since the customized entry always win, even if an overlay has already packaged a web.xml previously.- Parameters:
context
- the packaging contextwebinfDir
- the web-inf directorymetainfDir
- the meta-inf directoryfailOnMissingWebXml
- if build should fail if web.xml is not found- Throws:
org.apache.maven.plugin.MojoFailureException
- if the web.xml is specified but does not exist and failOnMissingWebXml is trueorg.apache.maven.plugin.MojoExecutionException
- if an error occurred while copying the descriptors
-
copyResources
public void copyResources(WarPackagingContext context, org.apache.maven.model.Resource resource) throws java.io.IOException, org.apache.maven.plugin.MojoExecutionException
Copies webapp webResources from the specified directory.- Parameters:
context
- the WAR packaging context to useresource
- the resource to copy- Throws:
java.io.IOException
- if an error occurred while copying the resourcesorg.apache.maven.plugin.MojoExecutionException
- if an error occurred while retrieving the filter properties
-
getFilesToCopy
private java.lang.String[] getFilesToCopy(org.apache.maven.model.Resource resource)
Returns a list of filenames that should be copied over to the destination directory.- Parameters:
resource
- the resource to be scanned- Returns:
- the array of filenames, relative to the sourceDir
-
-