Hi Claude, I was finally able to got a simple code working :-) . public class Main {
public static void main(String[] args) throws Exception { VelocityContext context = new VelocityContext(); Writer writer = new StringWriter(); CustomEvent event = new CustomEvent("subash"); context.put("event", event); Template template = createTemplate("eventtool.vm"); template.merge(context, writer); System.out.println(writer); writer.close(); } private static Template createTemplate(String vmTemplateFile) throws Exception { VelocityEngine ve = new VelocityEngine(); Properties properties = new Properties(); properties.put("resource.loader", "class"); properties.put("class.resource.loader.description","Template Class Loader"); properties.put("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); ve.init(properties); return ve.getTemplate(vmTemplateFile); } --------------------------------------------------------------------------------------------------------------------------------- And here is the template and the out put. *eventtool.vm* $event; Event Created by $event.getName() Event Created on $event.getDate() *Output* * * This is a test event template: created bysubash on Thu Jul 26 23:57:25 IST 2012; Event Created by subash Event Created on Thu Jul 26 23:57:25 IST 2012 On Sun, Jul 22, 2012 at 4:54 PM, Claude Brisson <cla...@renegat.net> wrote: > > Did you mean Velocity maven plugin tool[1] as the command line tool ? > > If not can you please direct me to a link to find the example to > > follow. Because in the documentation page there are links to XML > > tool, View tool, JSP tool and etc. And couldn't find "command line > > tool" thing . Correct me if I am looking for irrelevant. > > > > [1] - > > > http://velocity.apache.org/tools/devel/maven-velocity-tools-plugin/index.html > > No, when I say "command line tool", I only mean a plain old Java object > with a "main(String args[])" method, that you can call from the command > line... > > > Claude > -- Thanks /Dishara