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,
org.apache.maven.artifact.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, org.apache.maven.plugin.MojoExecutionException
targetPrefix
parameter to specify in which particular directory the files should be copied. Use null
to copy the
files with the same structuresourceId
- 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 filesorg.apache.maven.plugin.MojoExecutionException
- if an error occurs.protected void copyFiles(String sourceId, WarPackagingContext context, File sourceBaseDir, PathSet sourceFilesSet, boolean filtered) throws 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.IOException
- if an error occurred while copying the filesorg.apache.maven.plugin.MojoExecutionException
- break the build.protected void copyFile(String sourceId, WarPackagingContext context, File file, String targetFilename) throws IOException
targetFileName
is the relative path according to the root of the generated web application.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, org.apache.maven.plugin.MojoExecutionException
targetFileName
is the relative path according to the root of the generated web application.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 copyingorg.apache.maven.plugin.MojoExecutionException
- if an error occurred while retrieving the filter propertiesprotected void doUnpack(WarPackagingContext context, File file, 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, 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)
null
or empty, the default includes are used.baseDir
- the base directory to start fromincludes
- the includesexcludes
- the excludesprotected PathSet getFilesToIncludes(File baseDir, String[] includes, String[] excludes, boolean includeDirectories)
null
or empty, the default includes are used.baseDir
- the base directory to start fromincludes
- the includesexcludes
- the excludesincludeDirectories
- include directories yes or not.protected String getArtifactFinalName(WarPackagingContext context, org.apache.maven.artifact.Artifact artifact) throws org.codehaus.plexus.interpolation.InterpolationException
outputFileNameMapping
is set, it is used, otherwise the standard naming scheme is used.context
- the packaging contextartifact
- the artifactorg.codehaus.plexus.interpolation.InterpolationException
- in case of interpolation problem.Copyright © 2002–2023 The Apache Software Foundation. All rights reserved.