public abstract class AbstractWarPackagingTask extends java.lang.Object implements WarPackagingTask
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASSES_PATH
The
classes path. |
static java.lang.String[] |
DEFAULT_INCLUDES
The default list of includes.
|
static java.lang.String |
LIB_PATH
The
lib path. |
static java.lang.String |
META_INF_PATH
The
META-INF path. |
static java.lang.String |
WEB_INF_PATH
The
WEB-INF path. |
Constructor and Description |
---|
AbstractWarPackagingTask() |
Modifier and Type | Method and Description |
---|---|
protected void |
copyFile(java.lang.String sourceId,
WarPackagingContext context,
java.io.File file,
java.lang.String targetFilename)
Copy the specified file if the target location has not yet already been used.
|
protected boolean |
copyFile(WarPackagingContext context,
java.io.File source,
java.io.File destination,
java.lang.String targetFilename,
boolean onlyIfModified)
Copy file from source to destination.
|
protected void |
copyFiles(java.lang.String sourceId,
WarPackagingContext context,
java.io.File sourceBaseDir,
PathSet sourceFilesSet,
boolean filtered)
Copies the files if possible as is.
|
protected void |
copyFiles(java.lang.String sourceId,
WarPackagingContext context,
java.io.File sourceBaseDir,
PathSet sourceFilesSet,
java.lang.String targetPrefix,
boolean filtered)
Copies the files if possible with an optional target prefix.
|
protected boolean |
copyFilteredFile(java.lang.String sourceId,
WarPackagingContext context,
java.io.File file,
java.lang.String targetFilename)
Copy the specified file if the target location has not yet already been used and filter its content with the
configured filter properties.
|
protected void |
doUnpack(WarPackagingContext context,
java.io.File file,
java.io.File unpackDirectory)
Unpacks the specified file to the specified directory.
|
protected java.lang.String |
getArtifactFinalName(WarPackagingContext context,
org.apache.maven.artifact.Artifact artifact)
Returns the final name of the specified artifact.
|
protected java.lang.String |
getEncoding(java.io.File webXml)
Get the encoding from an XML-file.
|
protected PathSet |
getFilesToIncludes(java.io.File baseDir,
java.lang.String[] includes,
java.lang.String[] excludes)
Returns the file to copy.
|
protected PathSet |
getFilesToIncludes(java.io.File baseDir,
java.lang.String[] includes,
java.lang.String[] excludes,
boolean includeDirectories)
Returns the file to copy.
|
private boolean |
isXmlFile(java.io.File file)
Returns
true if the File -object is a file (not a directory) that is not
null and has a file name that ends in ".xml". |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
performPackaging
public static final java.lang.String[] DEFAULT_INCLUDES
public static final java.lang.String WEB_INF_PATH
WEB-INF
path.public static final java.lang.String META_INF_PATH
META-INF
path.public static final java.lang.String CLASSES_PATH
classes
path.public static final java.lang.String LIB_PATH
lib
path.protected void copyFiles(java.lang.String sourceId, WarPackagingContext context, java.io.File sourceBaseDir, PathSet sourceFilesSet, java.lang.String targetPrefix, boolean filtered) throws java.io.IOException, org.apache.maven.plugin.MojoExecutionException
sourceId
- the source idcontext
- the context to usesourceBaseDir
- the base directory from which the sourceFilesSet will be copiedsourceFilesSet
- the files to be copiedtargetPrefix
- the prefix to add to the target file namefiltered
- filter or not.java.io.IOException
- if an error occurred while copying the filesorg.apache.maven.plugin.MojoExecutionException
- if an error occurs.protected void copyFiles(java.lang.String sourceId, WarPackagingContext context, java.io.File sourceBaseDir, PathSet sourceFilesSet, boolean filtered) throws java.io.IOException, org.apache.maven.plugin.MojoExecutionException
sourceId
- the source idcontext
- the context to usesourceBaseDir
- the base directory from which the sourceFilesSet will be copiedsourceFilesSet
- the files to be copiedfiltered
- filter or not.java.io.IOException
- if an error occurred while copying the filesorg.apache.maven.plugin.MojoExecutionException
- break the build.protected void copyFile(java.lang.String sourceId, WarPackagingContext context, java.io.File file, java.lang.String targetFilename) throws java.io.IOException
sourceId
- the source idcontext
- the context to usefile
- the file to copytargetFilename
- the relative path according to the root of the webappjava.io.IOException
- if an error occurred while copyingprotected boolean copyFilteredFile(java.lang.String sourceId, WarPackagingContext context, java.io.File file, java.lang.String targetFilename) throws java.io.IOException, org.apache.maven.plugin.MojoExecutionException
sourceId
- the source idcontext
- the context to usefile
- the file to copytargetFilename
- the relative path according to the root of the webappjava.io.IOException
- if an error occurred while copyingorg.apache.maven.plugin.MojoExecutionException
- if an error occurred while retrieving the filter propertiesprotected void doUnpack(WarPackagingContext context, java.io.File file, java.io.File unpackDirectory) throws org.apache.maven.plugin.MojoExecutionException
context
- the packaging contextfile
- the file to unpackunpackDirectory
- the directory to use for th unpacked fileorg.apache.maven.plugin.MojoExecutionException
- if an error occurred while unpacking the fileprotected boolean copyFile(WarPackagingContext context, java.io.File source, java.io.File destination, java.lang.String targetFilename, boolean onlyIfModified) throws java.io.IOException
destination
will be created if they
don't already exist. if the onlyIfModified
flag is false, destination
will be
overwritten if it already exists. If the flag is true destination will be overwritten if it's not up to
date.context
- the packaging contextsource
- an existing non-directory File
to copy bytes fromdestination
- a non-directory File
to write bytes to (possibly overwriting).targetFilename
- the relative path of the file from the webapp root directoryonlyIfModified
- if true, copy the file only if the source has changed, always copy otherwisejava.io.IOException
- if source
does not exist, destination
cannot be written to, or an
IO error occurs during copyingprotected java.lang.String getEncoding(java.io.File webXml) throws java.io.IOException
webXml
- the XML-filejava.io.IOException
- if an error occurred while reading the fileprotected PathSet getFilesToIncludes(java.io.File baseDir, java.lang.String[] includes, java.lang.String[] excludes)
baseDir
- the base directory to start fromincludes
- the includesexcludes
- the excludesprotected PathSet getFilesToIncludes(java.io.File baseDir, java.lang.String[] includes, java.lang.String[] excludes, boolean includeDirectories)
baseDir
- the base directory to start fromincludes
- the includesexcludes
- the excludesincludeDirectories
- include directories yes or not.protected java.lang.String getArtifactFinalName(WarPackagingContext context, org.apache.maven.artifact.Artifact artifact) throws org.codehaus.plexus.interpolation.InterpolationException
context
- the packaging contextartifact
- the artifactorg.codehaus.plexus.interpolation.InterpolationException
- in case of interpolation problem.private boolean isXmlFile(java.io.File file)
true
if the File
-object is a file (not a directory) that is not
null
and has a file name that ends in ".xml".file
- The file to checktrue
if the file is an xml-file, otherwise false