public abstract class AbstractWarPackagingTask extends Object implements WarPackagingTask
Modifier and Type | Field and Description |
---|---|
static String |
CLASSES_PATH
The
classes path. |
static String[] |
DEFAULT_INCLUDES
The default list of includes.
|
static String |
LIB_PATH
The
lib path. |
static String |
META_INF_PATH
The
META-INF path. |
static String |
WEB_INF_PATH
The
WEB-INF path. |
Constructor and Description |
---|
AbstractWarPackagingTask() |
Modifier and Type | Method and Description |
---|---|
protected void |
copyFile(String sourceId,
WarPackagingContext context,
File file,
String targetFilename)
Copy the specified file if the target location has not yet already been used.
|
protected boolean |
copyFile(WarPackagingContext context,
File source,
File destination,
String targetFilename,
boolean onlyIfModified)
Copy file from source to destination.
|
protected void |
copyFiles(String sourceId,
WarPackagingContext context,
File sourceBaseDir,
PathSet sourceFilesSet,
boolean filtered)
Copies the files if possible as is.
|
protected void |
copyFiles(String sourceId,
WarPackagingContext context,
File sourceBaseDir,
PathSet sourceFilesSet,
String targetPrefix,
boolean filtered)
Copies the files if possible with an optional target prefix.
|
protected boolean |
copyFilteredFile(String sourceId,
WarPackagingContext context,
File file,
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,
File file,
File unpackDirectory)
Unpacks the specified file to the specified directory.
|
protected String |
getArtifactFinalName(WarPackagingContext context,
Artifact artifact)
Returns the final name of the specified artifact.
|
protected String |
getEncoding(File webXml)
Get the encoding from an XML-file.
|
protected PathSet |
getFilesToIncludes(File baseDir,
String[] includes,
String[] excludes)
Returns the file to copy.
|
protected PathSet |
getFilesToIncludes(File baseDir,
String[] includes,
String[] excludes,
boolean includeDirectories)
Returns the file to copy.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
performPackaging
public static final String[] DEFAULT_INCLUDES
public static final String WEB_INF_PATH
WEB-INF
path.public static final String META_INF_PATH
META-INF
path.public static final String CLASSES_PATH
classes
path.public static final String LIB_PATH
lib
path.protected void copyFiles(String sourceId, WarPackagingContext context, File sourceBaseDir, PathSet sourceFilesSet, String targetPrefix, boolean filtered) throws IOException, 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.IOException
- if an error occurred while copying the filesMojoExecutionException
- if an error occurs.protected void copyFiles(String sourceId, WarPackagingContext context, File sourceBaseDir, PathSet sourceFilesSet, boolean filtered) throws IOException, 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.IOException
- if an error occurred while copying the filesMojoExecutionException
- break the build.protected void copyFile(String sourceId, WarPackagingContext context, File file, String targetFilename) throws IOException
sourceId
- the source idcontext
- the context to usefile
- the file to copytargetFilename
- the relative path according to the root of the webappIOException
- if an error occurred while copyingprotected boolean copyFilteredFile(String sourceId, WarPackagingContext context, File file, String targetFilename) throws IOException, MojoExecutionException
sourceId
- the source idcontext
- the context to usefile
- the file to copytargetFilename
- the relative path according to the root of the webappIOException
- if an error occurred while copyingMojoExecutionException
- if an error occurred while retrieving the filter propertiesprotected void doUnpack(WarPackagingContext context, File file, File unpackDirectory) throws MojoExecutionException
context
- the packaging contextfile
- the file to unpackunpackDirectory
- the directory to use for th unpacked fileMojoExecutionException
- if an error occurred while unpacking the fileprotected boolean copyFile(WarPackagingContext context, File source, File destination, String targetFilename, boolean onlyIfModified) throws 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 otherwiseIOException
- if source
does not exist, destination
cannot be written to, or an
IO error occurs during copyingprotected String getEncoding(File webXml) throws IOException
webXml
- the XML-fileIOException
- if an error occurred while reading the fileprotected PathSet getFilesToIncludes(File baseDir, String[] includes, String[] excludes)
baseDir
- the base directory to start fromincludes
- the includesexcludes
- the excludesprotected PathSet getFilesToIncludes(File baseDir, String[] includes, String[] excludes, boolean includeDirectories)
baseDir
- the base directory to start fromincludes
- the includesexcludes
- the excludesincludeDirectories
- include directories yes or not.protected String getArtifactFinalName(WarPackagingContext context, Artifact artifact) throws InterpolationException
context
- the packaging contextartifact
- the artifactInterpolationException
- in case of interpolation problem.Copyright © 2002–2018 The Apache Software Foundation. All rights reserved.