I need to generate a few small text files that will be used as inputs during generate-sources phase of another project (data files input to FMPP/FreeMarker). The generator is Java source code – that is, the code that generates the text files is compiled in the first project. In this kind of scenario, how are the data files normally conveyed from one project to the other?
I could cobble together a dozen lame ways to do this – I’m looking for best practice.
At the moment, I’m avoiding the problem by having the first project just produce an executable jar, which is run by the second project to produce the data files. But there’s really no reason for the code to be “public” – to be installed – the output of the first project really should just be the TDD files.
I’m not sure I have the full picture of what you’re trying to do here but it sounds to me like you should be using the maven dependency plugin.
I’m assuming that the first project would create an artifact with the data files you need for the second and other projects. The second project could use the dependency plugin to unpack that artifact into target/generated-sources or wherever it is needed as part of its build.
For example: