templating:filter-sources

Full name:

org.codehaus.mojo:templating-maven-plugin:1.0-alpha-3:filter-sources

Description:

This mojo helps adding a filtered source folder in one go. This is typically useful if you want to use properties coming from the POM inside parts of your source code that requires real constants, like annotations for example.

Attributes:

  • Requires a Maven project to be executed.
  • The goal is thread-safe and supports parallel builds.
  • Binds by default to the lifecycle phase: generate-sources.

Optional Parameters

Name Type Since Description
delimiters List - 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).
encoding String - The character encoding scheme to be applied when filtering resources.
Default value is: ${project.build.sourceEncoding}.
escapeString String - Expression preceded with the String won't be interpolated \${foo} will be replaced with ${foo}
User property is: maven.resources.escapeString.
outputDirectory File - Output folder where filtered sources will land.
Default value is: ${project.build.directory}/generated-sources/java-templates.
sourceDirectory File - Source directory that will be first filtered and then added as a classical source folder.
Default value is: ${basedir}/src/main/java-templates.
useDefaultDelimiters boolean - Controls whether the default delimiters are included in addition to those configured delimiters. Does not have any effect if delimiters is empty when the defaults will be included anyway.
Default value is: true.

Parameter Details

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).
  • Type: java.util.List
  • Required: No

encoding:

The character encoding scheme to be applied when filtering resources.
  • Type: java.lang.String
  • Required: No
  • Default: ${project.build.sourceEncoding}

escapeString:

Expression preceded with the String won't be interpolated \${foo} will be replaced with ${foo}
  • Type: java.lang.String
  • Required: No
  • User Property: maven.resources.escapeString

outputDirectory:

Output folder where filtered sources will land.
  • Type: java.io.File
  • Required: No
  • Default: ${project.build.directory}/generated-sources/java-templates

sourceDirectory:

Source directory that will be first filtered and then added as a classical source folder.
  • Type: java.io.File
  • Required: No
  • Default: ${basedir}/src/main/java-templates

useDefaultDelimiters:

Controls whether the default delimiters are included in addition to those configured delimiters. Does not have any effect if delimiters is empty when the defaults will be included anyway.
  • Type: boolean
  • Required: No
  • Default: true