maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Broyer <t.bro...@gmail.com>
Subject Re: How to escape variable interpolation?
Date Thu, 29 Jan 2015 09:14:33 GMT
On Wed Jan 28 2015 at 20:18:53 David Hoffer <dhoffer6@gmail.com> wrote:

> I have a case where I have a text file that is generated with a hard coded
> string and I would like to replace that with Maven variables, but I want
> the literal variable string to go in the file not the interpolated values.
>
> I read http://maven.apache.org/shared/maven-filtering/ that i should be
> able to do this with a leading \ but that doesn't work.  It still
> resolves ${service.root.url}.
>
> <execution>
>     <id>replace-namespace</id>
>     <phase>generate-resources</phase>
>     <goals>
>         <goal>run</goal>
>     </goals>
>     <configuration>
>         <failOnError>true</failOnError>
>         <target>
>             <replace
> dir="${project.build.directory}/generated-resources/META-INF/" token="
> http://jmsappsvr/bullpen/service"
> value="\${service.root.url}/bullpen/readwrite" >
>

That property is substituted during evaluation of the POM, not by the
maven-filtering (which, to my knowledge, is not used in this case).

According to https://stackoverflow.com/q/7751696/116472,
$${service.root.url} might work (or not). Using a unicode escape for the
'$' sign worked for some people:
value="\u0024{service.root.url}/bullpen/readwrite"; and despite the
comments in this QA, I'd try defining a <dollar>$</dollar> property and
then using ${dollar}{service.root.url}.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message