Tomas
Tomas

Reputation: 1725

Ant replace in maven2?

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!

Upvotes: 1

Views: 2787

Answers (4)

steven
steven

Reputation:

keep up with the maven-replacer-plugin, the project is still alive and well

Upvotes: 3

Brian Fox
Brian Fox

Reputation: 6832

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

Upvotes: 4

Steve Reed
Steve Reed

Reputation: 2541

Maven's resource filtering might help you out.

Upvotes: 2

kgiannakakis
kgiannakakis

Reputation: 104196

Why don't you use the Maven-ant plug-in?

Upvotes: 0

Related Questions