How do I expand properties while copying a file that contains backslashes?

(David Moles) #1

I have an XML file that contains the line


Except they’re not forward slashes, they’re backslashes. (If I put the literal string in here with backslashes, the forum software seems to get confused and mess up the formatting.)

The purpose of the backslashes is to escape the dots; this is going to be interpreted as a regular expression.

When I try to copy this file with


I get the following error:

Caused by: groovy.lang.GroovyRuntimeException: Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: > SimpleTemplateScript1.groovy: 49: unexpected char: ’

(The unexpected char is a backslash; again, that seems to make the forum software unhappy)

Is this a known issue? Is there a preferred workaround?

(Peter Niederwieser) #2

I don’t know why ‘SimpleTemplateEngine’ chokes on this, but the likely solution is not to use ‘expand’ but one of the other ways to substitute properties (see docs).