Fork me on GitHub

templating:filter-test-sources

Full name:

org.codehaus.mojo:templating-maven-plugin:1.0.0:filter-test-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 test 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-test-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.
overwrite boolean - Controls whether to overwrite files that are not changed, by default files will not be overwritten
Default value is: false.
skipPoms boolean - Skips POM projects if set to true, which is the default option.
Default value is: true.
testOutputDirectory File - Output folder where filtered test sources will land.
Default value is: ${project.build.directory}/generated-test-sources/java-templates.
testSourceDirectory File - Source directory that will be first filtered and then added as a classical source folder.
Default value is: ${basedir}/src/test/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

overwrite:

Controls whether to overwrite files that are not changed, by default files will not be overwritten
  • Type: boolean
  • Required: No
  • Default: false

skipPoms:

Skips POM projects if set to true, which is the default option.
  • Type: boolean
  • Required: No
  • Default: true

testOutputDirectory:

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

testSourceDirectory:

Source directory that will be first filtered and then added as a classical source folder.
  • Type: java.io.File
  • Required: No
  • Default: ${basedir}/src/test/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