Insert contents of files into strings

So I’m trying to set the contents of static final strings of a class to the content of files during or before compilation.
I know you can use filter (ReplaceTokens, tokens: [token: "123"]) and then String token = "@token@"; in the code, which I already use. I was thinking about scanning through a directory and creating the tokens mapping from that, however I’m not sure on how to do that.

Tips on how I could create a tokens mapping dynamically from a directory of files, would also be helpful, as that is the piece I’m missing at the moment.