Class WarProjectPackagingTask
java.lang.Object
org.apache.maven.plugins.war.packaging.AbstractWarPackagingTask
org.apache.maven.plugins.war.packaging.WarProjectPackagingTask
- All Implemented Interfaces:
WarPackagingTask
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
FieldsModifier and TypeFieldDescriptionprivate final File
private Overlay
private final String
private final org.apache.maven.model.Resource[]
private final File
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
ConstructorsConstructorDescriptionWarProjectPackagingTask
(org.apache.maven.model.Resource[] webResources, File webXml, File containerConfigXml, Overlay currentProjectOverlay) -
Method Summary
Modifier and TypeMethodDescriptionvoid
copyResources
(WarPackagingContext context, org.apache.maven.model.Resource resource) Copies webapp webResources from the specified directory.private 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
Handles the webapp classes.protected void
handleDeploymentDescriptors
(WarPackagingContext context, File webinfDir, File metainfDir, Boolean failOnMissingWebXml) Handles the deployment descriptors, if specified.protected void
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 Details
-
webResources
private final org.apache.maven.model.Resource[] webResources -
webXml
-
containerConfigXML
-
id
-
currentProjectOverlay
-
-
Constructor Details
-
WarProjectPackagingTask
public WarProjectPackagingTask(org.apache.maven.model.Resource[] webResources, File webXml, File containerConfigXml, Overlay currentProjectOverlay) - Parameters:
webResources
-webResources
webXml
-webXml
containerConfigXml
-containerConfigXML
currentProjectOverlay
-currentProjectOverlay
-
-
Method Details
-
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, File webinfDir, File metainfDir, 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 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:
IOException
- if an error occurred while copying the resourcesorg.apache.maven.plugin.MojoExecutionException
- if an error occurred while retrieving the filter properties
-
getFilesToCopy
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
-