views:

315

answers:

2

By default maven will filter resources like this:

<properties>
  <replace.me>value</replace.me>
</properties>

<some-tag>
  <key>${replace.me}</key>
</some-tag>

will get you:

<some-tag>
  <key>value</key>
</some-tag>

Is there a way to override the way maven selects the strings to replace? Specifically, I want to be able to use this:

<some-tag>
  <key>@replace.me@</key>
</some-tag>

to get the same result as above.

+7  A: 

Have a look at the delimiters parameter of the resources mojo. Configuring the plugin like this will do the trick:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-resources-plugin</artifactId>
  <version>2.4.2</version>
  <configuration>
    <delimiters>
     <delimiter>${*}</delimiter><!-- to keep the default behavior -->
     <delimiter>@</delimiter><!-- to add Ant-like tokens style -->
    </delimiters>
  </configuration>
</plugin>
Pascal Thivent
+2  A: 

If you would like to use only one approach then disable default delimeters:

<useDefaultDelimiters>false</useDefaultDelimiters>
<delimiters>
  <delimiter>@</delimiter>
</delimiters>
eugenn