VelocityBuilder is a plugin
for Eclipse to generate output files from input files using Velocity. An Eclipse
Builder will provide for regeneration of the output files if the input file
It uses a very flexible concept called Template Mappings. A 'Template
specifies how a Velocity Template is matched to an input file, how the velocity
context is provided from the input file and where the output file should go.
Once this is set up, VelocityBuilder watches for changes in participant files
and updates the generated output automatically.
Generated files could include Java Source Code, HTML, JSPs, XML, Reports,
whatever fits in a file.
For an Input Source Velocity provides the concept of a 'ContextAdapter'.
A Context Adapter takes a generation source file, parses it and provides a
Java Object representing this source file. The resulting Java Object is set
into the velocity context.
Currently there are not many context adapters available, actually there is
only one to demonstrate/test the Eclipse extension point, but I can imagine
quite a lot (and *you* can contribute your context adapter as Eclipse Plugin):
- EMF Model Context Adapter: loads an emf model file and sets the
corresponding model into the velocity context
- XML Context Adapter: loads an XML file and sets the DOM into the velocity
- QDox Context Adapter: parses a Java Source File and sets the resulting
QDox model into the velocity context
- Slime UML Context Adapter: parses a Slime UML diagram and makes the diagram
items available in the Velocity context
You can download the
current version at SourceForge, I have set up a demo project in the SourceForge
CVS to see how it works using a very primitive Context
Adapter for specifying value Objects.
The Demo Project is an Eclipse 3.1 Project