Replace Tokens Step

This step replaces tokens in files.

Required properties:

Property Name Description
Include Files

Specify a comma or space-separated list of patterns of files to include.

Pattern Matching Rules:

* matches zero or more characters

? matches one character

** matches zero or more directories

Examples:

*.java - matches .java, x.java, and FooBar.java

?.java - matches x.java, A.java

**/*.txt - matches all txt files recursively

**/CVS/* - matches all files in CVS directories anywhere in the directory tree

org/apache/jakarta/** - matches all files in the org/apache/jakarta directory tree

org/apache/**/CVS/* - matches all files in CVS directories anywhere in the in the directory tree under org/apache/

**/test/** - matches all files that have a test element in their path, including test as a filename

Property File

Specify the name of a file in which to store the replacement name/value pairs. You can use an existing file. If this file does not exist before the step is run, it is created by the plugin and removed upon completion. If it does exist before the step is run, it is retained.

Optional properties:

Property Name Description
Directory Offset

The directory relative to the current working directory that contains the files on which to operate

Exclude Files Specify a comma or space-separated list of patterns of files to exclude. Pattern matching rules are the same as those listed in Include Files.
Start Token Delimiter

Specify one or more characters to indicate where a token to replace begins.

End Token Delimiter Specify one or more characters to indicate where a token to replace ends.
Property Prefix

Specify a prefix to be used to determine which properties to include in token replacement. For example, name matches nameA and nameB. Leave blank to use all properties.

Property List

Specify a value here for the step to use existing property names as tokens to replace in the target files.

Examples:

${p:environment/allProperties} takes all component environment properties and uses the property name as the token and the value as the replacement.

${p:component/allProperties},${p:environment/allProperties} takes all component and component environment properties and uses them as token replacements.

The delimiter and prefix settings apply. If you have @ for start and end token delimiter and a property called token1, the step searches for @token1@ to replace.

Explicit Tokens

Specify a new-line-separated list of tokens to replace, in the form of token->value.

Example:

mytoken->new_value looks for the mytoken string in all the files and replaces it with new_value.

The tokens used in this field are not affected by the delimiter or prefix options. To replace @token@ with new_value, you must specify @token@->new_value here.

If you specify a value in Property List, the explicit tokens are added as additional values to replace and override any properties that have the same name. You cannot use regular expressions here.