@Mojo(name="resources", defaultPhase=PROCESS_RESOURCES, requiresProject=true, threadSafe=true) public class ResourcesMojo extends AbstractMojo implements org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
Modifier and Type | Field and Description |
---|---|
protected boolean |
addDefaultExcludes
By default files like
.gitignore , .cvsignore etc. are excluded which means they will not being
copied. |
protected List<String> |
buildFilters
The list of additional filter properties files to be used along with System and project properties, which would
be used for the filtering.
|
protected LinkedHashSet<String> |
delimiters
Set of delimiters for expressions to filter within the resources.
|
protected String |
encoding
The character encoding scheme to be applied when filtering resources.
|
protected String |
escapeString
Expressions preceded with this string won't be interpolated.
|
protected boolean |
escapeWindowsPaths
Whether to escape backslashes and colons in windows-style paths.
|
protected List<String> |
filters
The list of extra filter properties files to be used along with System properties, project properties, and filter
properties files specified in the POM build/filters section, which should be used for the filtering during the
current mojo execution.
|
protected boolean |
includeEmptyDirs
Copy any empty directories included in the Resources.
|
protected org.apache.maven.shared.filtering.MavenResourcesFiltering |
mavenResourcesFiltering |
protected List<String> |
nonFilteredFileExtensions
Additional file extensions to not apply filtering (already defined are : jpg, jpeg, gif, bmp, png)
|
protected MavenProject |
project |
protected MavenSession |
session |
protected boolean |
useBuildFilters
If false, don't use the filters specified in the build/filters section of the POM when processing resources in
this mojo execution.
|
protected boolean |
useDefaultDelimiters
Use default delimiters in addition to custom delimiters, if any.
|
Constructor and Description |
---|
ResourcesMojo() |
Modifier and Type | Method and Description |
---|---|
void |
contextualize(org.codehaus.plexus.context.Context context) |
void |
execute() |
protected void |
executeUserFilterComponents(org.apache.maven.shared.filtering.MavenResourcesExecution mavenResourcesExecution) |
protected List<String> |
getCombinedFiltersList() |
LinkedHashSet<String> |
getDelimiters() |
List<String> |
getFilters() |
File |
getOutputDirectory() |
List<Resource> |
getResources() |
boolean |
isIncludeEmptyDirs() |
boolean |
isOverwrite() |
boolean |
isSkip() |
boolean |
isUseDefaultDelimiters() |
void |
setDelimiters(LinkedHashSet<String> delimiters) |
void |
setFilters(List<String> filters) |
void |
setIncludeEmptyDirs(boolean includeEmptyDirs) |
void |
setOutputDirectory(File outputDirectory) |
void |
setOverwrite(boolean overwrite) |
void |
setResources(List<Resource> resources) |
void |
setUseDefaultDelimiters(boolean useDefaultDelimiters) |
getLog, getPluginContext, setLog, setPluginContext
@Parameter(defaultValue="${project.build.sourceEncoding}") protected String encoding
@Parameter(defaultValue="${project}", readonly=true, required=true) protected MavenProject project
@Parameter(defaultValue="${project.build.filters}", readonly=true) protected List<String> buildFilters
filters
.@Parameter protected List<String> filters
default-resources
and default-testResources
to supply different configurations
for the two different types of resources. By supplying extraFilters
configurations, you can separate
which filters are used for which type of resource.@Parameter(defaultValue="true") protected boolean useBuildFilters
buildFilters
and filters
@Component(role=org.apache.maven.shared.filtering.MavenResourcesFiltering.class, hint="default") protected org.apache.maven.shared.filtering.MavenResourcesFiltering mavenResourcesFiltering
@Parameter(defaultValue="${session}", readonly=true, required=true) protected MavenSession session
@Parameter protected String escapeString
\${foo}
will be replaced with ${foo}
but \\${foo}
will be replaced with \\value of foo
, if this parameter has been set to the backslash.
@Parameter(defaultValue="false") protected boolean includeEmptyDirs
@Parameter protected List<String> nonFilteredFileExtensions
@Parameter(defaultValue="true") protected boolean escapeWindowsPaths
@Parameter protected LinkedHashSet<String> delimiters
Set of delimiters for expressions to filter within the resources. These delimiters are specified in the form
beginToken*endToken
. If no *
is given, the delimiter is assumed to be the same for start and end.
So, the default filtering delimiters might be specified as:
<delimiters> <delimiter>${*}</delimiter> <delimiter>@</delimiter> </delimiters>
Since the @
delimiter is the same on both ends, we don't need to specify @*@
(though we can).
@Parameter(defaultValue="true") protected boolean useDefaultDelimiters
@Parameter(defaultValue="true") protected boolean addDefaultExcludes
.gitignore
, .cvsignore
etc. are excluded which means they will not being
copied. If you need them for a particular reason you can do that by settings this to false
. This means
all files like the following will be copied.
public void contextualize(org.codehaus.plexus.context.Context context) throws org.codehaus.plexus.context.ContextException
contextualize
in interface org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
org.codehaus.plexus.context.ContextException
public void execute() throws MojoExecutionException
execute
in interface Mojo
MojoExecutionException
protected void executeUserFilterComponents(org.apache.maven.shared.filtering.MavenResourcesExecution mavenResourcesExecution) throws MojoExecutionException, org.apache.maven.shared.filtering.MavenFilteringException
mavenResourcesExecution
- MavenResourcesExecution
MojoExecutionException
- in case of wrong lookup.org.apache.maven.shared.filtering.MavenFilteringException
- in case of failure.protected List<String> getCombinedFiltersList()
public void setResources(List<Resource> resources)
resources
- set resources
public File getOutputDirectory()
outputDirectory
public void setOutputDirectory(File outputDirectory)
outputDirectory
- the output folder.public boolean isOverwrite()
overwrite
public void setOverwrite(boolean overwrite)
overwrite
- true to overwrite false otherwise.public boolean isIncludeEmptyDirs()
includeEmptyDirs
public void setIncludeEmptyDirs(boolean includeEmptyDirs)
includeEmptyDirs
- true/false.public LinkedHashSet<String> getDelimiters()
delimiters
public void setDelimiters(LinkedHashSet<String> delimiters)
delimiters
- The delimiters to use.public boolean isUseDefaultDelimiters()
useDefaultDelimiters
public void setUseDefaultDelimiters(boolean useDefaultDelimiters)
useDefaultDelimiters
- true to use ${*}
public boolean isSkip()
skip
Copyright © 2001–2016 The Apache Software Foundation. All rights reserved.