What is the most effective way to replace multiple string tokens in multiple Java files?

advertisements

What I want to accomplish is a tool that filters my files replacing the occurrences of strings in this format ${some.property} with a value got from a properties file (just like Maven's or Ant's file filtering feature).

My first approach was to use Ant API (copy-task) or Maven Filtering component but both include many unnecessary dependencies and my program should be lightweight. After, I searched a little in Apache Common haven't found anything yet.

Is there an efficient (and elegant) solution to my problem?


The most efficient solution is using a templating engine. There are few, widely used engines, that comes in a single jar :