Class ResourcesMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.plugins.resources.ResourcesMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
CopyResourcesMojo,TestResourcesMojo
@Mojo(name="resources", defaultPhase=PROCESS_RESOURCES, threadSafe=true) public class ResourcesMojo extends org.apache.maven.plugin.AbstractMojoCopy resources for the main source code to the main output directory. Always uses the project.build.resources element to specify the resources to copy.- Author:
- Michal Maczka, Jason van Zyl, Andreas Hoheneder, William Ferguson
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanaddDefaultExcludesBy default files like.gitignore,.cvsignoreetc.protected java.util.List<java.lang.String>buildFiltersThe list of additional filter properties files to be used along with System and project properties, which would be used for the filtering.protected java.util.LinkedHashSet<java.lang.String>delimitersSet of delimiters for expressions to filter within the resources.protected java.lang.StringencodingThe character encoding to use when reading and writing filtered resources.protected java.lang.StringescapeStringExpressions preceded with this string won't be interpolated.protected booleanescapeWindowsPathsWhether to escape backslashes and colons in windows-style paths.protected java.util.List<java.lang.String>filtersThe 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 booleanincludeEmptyDirsCopy any empty directories included in the Resources.protected org.apache.maven.shared.filtering.MavenResourcesFilteringmavenResourcesFilteringprotected java.util.Map<java.lang.String,org.apache.maven.shared.filtering.MavenResourcesFiltering>mavenResourcesFilteringMapprotected java.util.List<java.lang.String>nonFilteredFileExtensionsAdditional file extensions to not apply filtering (already defined are : jpg, jpeg, gif, bmp, png)protected org.apache.maven.project.MavenProjectprojectprotected java.lang.StringpropertiesEncodingThe character encoding to use when reading and writing filtered properties files.protected org.apache.maven.execution.MavenSessionsessionprotected booleanuseBuildFiltersIf false, don't use the filters specified in the build/filters section of the POM when processing resources in this mojo execution.protected booleanuseDefaultDelimitersUse default delimiters in addition to custom delimiters, if any.
-
Constructor Summary
Constructors Constructor Description ResourcesMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute()protected voidexecuteUserFilterComponents(org.apache.maven.shared.filtering.MavenResourcesExecution mavenResourcesExecution)protected java.util.List<java.lang.String>getCombinedFiltersList()java.util.LinkedHashSet<java.lang.String>getDelimiters()java.util.List<java.lang.String>getFilters()java.io.FilegetOutputDirectory()java.util.List<org.apache.maven.model.Resource>getResources()booleanisIncludeEmptyDirs()booleanisOverwrite()booleanisSkip()booleanisUseDefaultDelimiters()voidsetDelimiters(java.util.LinkedHashSet<java.lang.String> delimiters)voidsetFilters(java.util.List<java.lang.String> filters)voidsetIncludeEmptyDirs(boolean includeEmptyDirs)voidsetOutputDirectory(java.io.File outputDirectory)voidsetOverwrite(boolean overwrite)voidsetResources(java.util.List<org.apache.maven.model.Resource> resources)voidsetUseDefaultDelimiters(boolean useDefaultDelimiters)
-
-
-
Field Detail
-
encoding
@Parameter(defaultValue="${project.build.sourceEncoding}") protected java.lang.String encodingThe character encoding to use when reading and writing filtered resources.
-
propertiesEncoding
@Parameter protected java.lang.String propertiesEncoding
The character encoding to use when reading and writing filtered properties files. If not specified, it will default to the value of the "encoding" parameter.- Since:
- 3.2.0
-
project
@Parameter(defaultValue="${project}", readonly=true, required=true) protected org.apache.maven.project.MavenProject project
-
buildFilters
@Parameter(defaultValue="${project.build.filters}", readonly=true) protected java.util.List<java.lang.String> buildFiltersThe list of additional filter properties files to be used along with System and project properties, which would be used for the filtering.- Since:
- 2.4
- See Also:
filters
-
filters
@Parameter protected java.util.List<java.lang.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.
Normally, these will be configured from a plugin's execution section, to provide a different set of filters for a particular execution. For instance, starting in Maven 2.2.0, you have the option of configuring executions with the id's
default-resourcesanddefault-testResourcesto supply different configurations for the two different types of resources. By supplyingextraFiltersconfigurations, you can separate which filters are used for which type of resource.
-
useBuildFilters
@Parameter(defaultValue="true") 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.- Since:
- 2.4
- See Also:
buildFilters,filters
-
mavenResourcesFiltering
@Inject protected org.apache.maven.shared.filtering.MavenResourcesFiltering mavenResourcesFiltering
-
mavenResourcesFilteringMap
@Inject protected java.util.Map<java.lang.String,org.apache.maven.shared.filtering.MavenResourcesFiltering> mavenResourcesFilteringMap
-
session
@Parameter(defaultValue="${session}", readonly=true, required=true) protected org.apache.maven.execution.MavenSession session
-
escapeString
@Parameter protected java.lang.String escapeString
Expressions preceded with this string won't be interpolated. Anything else preceded with this string will be passed through unchanged. For example\${foo}will be replaced with${foo}but\\${foo}will be replaced with\\value of foo, if this parameter has been set to the backslash.- Since:
- 2.3
-
includeEmptyDirs
@Parameter(defaultValue="false") protected boolean includeEmptyDirs
Copy any empty directories included in the Resources.- Since:
- 2.3
-
nonFilteredFileExtensions
@Parameter protected java.util.List<java.lang.String> nonFilteredFileExtensions
Additional file extensions to not apply filtering (already defined are : jpg, jpeg, gif, bmp, png)- Since:
- 2.3
-
escapeWindowsPaths
@Parameter(defaultValue="true") protected boolean escapeWindowsPaths
Whether to escape backslashes and colons in windows-style paths.- Since:
- 2.4
-
delimiters
@Parameter protected java.util.LinkedHashSet<java.lang.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).- Since:
- 2.4
-
useDefaultDelimiters
@Parameter(defaultValue="true") protected boolean useDefaultDelimiters
Use default delimiters in addition to custom delimiters, if any.- Since:
- 2.4
-
addDefaultExcludes
@Parameter(defaultValue="true") protected boolean addDefaultExcludes
By default files like.gitignore,.cvsignoreetc. are excluded which means they will not being copied. If you need them for a particular reason you can do that by settings this tofalse. This means all files like the following will be copied.- Misc: **/*~, **/#*#, **/.#*, **/%*%, **/._*
- CVS: **/CVS, **/CVS/**, **/.cvsignore
- RCS: **/RCS, **/RCS/**
- SCCS: **/SCCS, **/SCCS/**
- VSSercer: **/vssver.scc
- MKS: **/project.pj
- SVN: **/.svn, **/.svn/**
- GNU: **/.arch-ids, **/.arch-ids/**
- Bazaar: **/.bzr, **/.bzr/**
- SurroundSCM: **/.MySCMServerInfo
- Mac: **/.DS_Store
- Serena Dimension: **/.metadata, **/.metadata/**
- Mercurial: **/.hg, **/.hg/**
- Git: **/.git, **/.git/**
- Bitkeeper: **/BitKeeper, **/BitKeeper/**, **/ChangeSet, **/ChangeSet/**
- Darcs: **/_darcs, **/_darcs/**, **/.darcsrepo, **/.darcsrepo/****/-darcs-backup*, **/.darcs-temp-mail
- Since:
- 3.0.0
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
executeUserFilterComponents
protected void executeUserFilterComponents(org.apache.maven.shared.filtering.MavenResourcesExecution mavenResourcesExecution) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.shared.filtering.MavenFilteringException- Parameters:
mavenResourcesExecution-MavenResourcesExecution- Throws:
org.apache.maven.plugin.MojoExecutionException- in case of wrong lookup.org.apache.maven.shared.filtering.MavenFilteringException- in case of failure.- Since:
- 2.5
-
getCombinedFiltersList
protected java.util.List<java.lang.String> getCombinedFiltersList()
- Returns:
- The combined filters.
-
getResources
public java.util.List<org.apache.maven.model.Resource> getResources()
- Returns:
resources
-
setResources
public void setResources(java.util.List<org.apache.maven.model.Resource> resources)
- Parameters:
resources- setresources
-
getOutputDirectory
public java.io.File getOutputDirectory()
- Returns:
outputDirectory
-
setOutputDirectory
public void setOutputDirectory(java.io.File outputDirectory)
- Parameters:
outputDirectory- the output folder.
-
isOverwrite
public boolean isOverwrite()
- Returns:
overwrite
-
setOverwrite
public void setOverwrite(boolean overwrite)
- Parameters:
overwrite- true to overwrite false otherwise.
-
isIncludeEmptyDirs
public boolean isIncludeEmptyDirs()
- Returns:
includeEmptyDirs
-
setIncludeEmptyDirs
public void setIncludeEmptyDirs(boolean includeEmptyDirs)
- Parameters:
includeEmptyDirs- true/false.
-
getFilters
public java.util.List<java.lang.String> getFilters()
- Returns:
filters
-
setFilters
public void setFilters(java.util.List<java.lang.String> filters)
- Parameters:
filters- The filters to use.
-
getDelimiters
public java.util.LinkedHashSet<java.lang.String> getDelimiters()
- Returns:
delimiters
-
setDelimiters
public void setDelimiters(java.util.LinkedHashSet<java.lang.String> delimiters)
- Parameters:
delimiters- The delimiters to use.
-
isUseDefaultDelimiters
public boolean isUseDefaultDelimiters()
- Returns:
useDefaultDelimiters
-
setUseDefaultDelimiters
public void setUseDefaultDelimiters(boolean useDefaultDelimiters)
- Parameters:
useDefaultDelimiters- true to use${*}
-
isSkip
public boolean isSkip()
- Returns:
skip
-
-