code2code is an eclipse plugin to generate code from templates. It allows Rails generators like functionality on java (or whatever) projects. Its main goal is easy generator creation by using known template engines, such as Freemarker, Velocity and Groovy Template Engine, and very few configuration. See it in action here.
The files:
HelloWorld.generator
|-- templates
|-- HelloWorldTemplate.txt.ftl
|-- templates.ftl
|-- params.ftl
Contents of HelloWorldTemplate.txt.ftl:
Hello ${name}!!!
Contents of params.ftl:
name=World
Contents of templates.ftl:
templates/HelloWorldTemplate.txt.ftl=src/HelloWorld.txt
code2code adds a “Generate…” option to your project context menu. When clicked, it will let you choose one of your generators (from the "generators" folder of your project), ask you the params you’ve specified (the params file), and then generate the result to the places you’ve told it (at the templates file).
See it in action here.
Current version is 0.9.1.1 beta, tested against Eclipse Ganymede 3.4.2.
You can install it from the Update Site