InputStream in = loader.getResourceAsStream("plugins.stg");
Reader reader = new InputStreamReader(in, Charset.forName(encoding));
StringTemplateGroup group = new StringTemplateGroup(reader);
StringTemplate template = group.getInstanceOf("plugin");
File targetFile = new File(sourcesDir, getClassName() + ".java");
Specification specification = null;
try {
specification = createSpecification();
getLog().info("Number of parameters: " + specification.getParameters().size());
template.setAttribute("spec", specification);
FileUtils.writeStringToFile(targetFile, template.toString(), encoding);
} catch (IOException ioe) {
if (specification == null) {
throw new MojoExecutionException("Failed to read parameters.", ioe);