/code2code

An Eclipse plugin to generate source code files using popular template engines

Primary LanguageJava

What it is

code2code is an eclipse plugin to generate source code from templates.

You can easily create your custom generators using known template engines: Groovy (JSP like), Freemarker or Velocity.

See it in action here.

Creating a Generator

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/destinationPath/HelloWorld.txt

Usage

Installing generators: just create a folder named "generators" at the root of your project, and place your generators there.

Running generators: The plugin adds a “Generate…” option to your project context menu (right-click menu). Run it, choose one of your installed generators, set its parameters, and the plugin will generate the files to the right place.

See it in action here: Quickly cruding with code2code plugin and VRaptor2.

Installation

Current version is 0.9.2 beta, tested against Eclipse Ganymede 3.4.2.

You can install it from the Update Site

Documentation

http://wiki.github.com/srizzo/code2code

Issues/Features

http://github.com/srizzo/code2code/issues

Generator Examples

http://github.com/srizzo/code2code-example-generators/downloads