0

I am currently working on a multi-module maven project. It has the following plugin :

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-resources-plugin</artifactId>
  <version>2.6</version>
  <configuration>
  <useDefaultDelimiters>false</useDefaultDelimiters>
    <delimiters>
     <delimiter>${*}</delimiter>
     <delimiter>@@</delimiter>
    </delimiters>
  </configuration>
</plugin>

From Maven documentation it is not very clear what this is exactly trying to do. Can someone please help me understand this.

Roland Weisleder
  • 9,668
  • 7
  • 37
  • 59
Santosh Pashupati
  • 499
  • 1
  • 6
  • 16
  • 1
    Why are you asking what some random piece of configuration is trying to do? Better tell us what *you* are trying to do. – Andrey Tyukin Dec 31 '18 at 14:39

1 Answers1

0

If you also define resource sets to be filtered, placeholders marked with these delimiters will be replaced by their respective property values.

That means if you configure the main resources to be filtered:

  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>

And you have a file src/main/resources/test.txt with this content:

The current project version is @@project.version@@

Then this file will be filtered and created in target/classes/test.txt with this content:

The current project version is 1.0-SNAPSHOT

The default delimiters allow to mark placeholders with ${key} or @key@, your example changes this to ${key} and @@key@@.

Also check https://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html#useDefaultDelimiters for further details.

Robert Panzer
  • 1,419
  • 12
  • 14