List templateList = generateType.getTemplate();
// For each velocity template in the template list pass in the XSD file list
for ( Object item: templateList){
TemplateType template = (TemplateType)item;
context.put("template", template);
String tmp = template.getTemplateName();
String filename = projectBuildDir + "/" + template.getTemplateTargetDir() + "/" + tmp.substring(0,tmp.length() - 3);
File f = new File(filename);
// Create folders since the package doesn't exist before the code-gen for the 1st time
f.getParentFile().mkdirs();
FileWriter fw = new FileWriter(f);
System.out.println(">> Processing " + template.getTemplateName() + " to " + filename);
Velocity.mergeTemplate(template.getTemplateName(), context, fw );
fw.flush();
fw.close();
}