R – Ant replace in maven2

antbuild-processconfigurationmaven-2

I'm looking for some way to replace patterns in files with values, during build time.

E.g. a configuration file may look the same except that different machines requires different hostnames in some setting. In that case i want to have a template file, where hostname is replaced with @@hostname@@
Then when building, I want to create separate versions of the file with the patter replaced with the correct value for each environment.

In ant you could use "replace", is there something similar in maven2? I know that I can run ant form maven, but if theres a maven plugin doing it, I'd prefer that one.

I found http://code.google.com/p/maven-replacer-plugin/
but it's very new…

Suggestions?

Thanks!

Best Answer

The resource plugin is what does filtering in Maven. IIRC it supports the ant syntax as well as the ${foo} maven syntax.

Related Topic