Skip to content

nnn-dev/code2code

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What it is

(nnn.)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.

Note: nnn.code2code is a fork of code2code with extra features (save/load parameters, allow overwride)

Creating a Generator

The files:

HelloWorld.generator
  |-- templates
      |-- HelloWorldTemplate.txt.ftl
      |-- ListParams.ftl
  |-- templates.ftl
  |-- postactions.ftl
  |-- params.ftl

Contents of HelloWorldTemplate.txt.ftl:

Hello ${name}!!!

Contents of ListParams.ftl:

Print vars => name=${name}

Contents of params.ftl:

name=World

Contents of templates.ftl:

templates/HelloWorldTemplate.txt.ftl=src/destinationPath/HelloWorld.txt

Contents of postactions.ftl

templates/ListParams.ftl

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.

Inner params:

  • eclipse_project_name : name of selected project
  • eclipse_project_path : path of selected project
  • eclipse_plugin_name : name of this plugin
  • eclipse_plugin_version : version of this plugin

Installation

Current version is 0.10.7, tested against Eclipse Kepler SR2.

You can install it from the Update Site

Documentation

http://wiki.github.com/nnn-dev/code2code

Issues/Features

http://github.com/nnn-dev/code2code/issues

Generator Examples

http://github.com/nnn-dev/code2code-example-generators/downloads

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%