use of org.codehaus.plexus.util.StringUtils in project maven-plugins by apache.
the class DefaultCheckstyleRssGenerator method generateRSS.
@Override
public void generateRSS(CheckstyleResults results, CheckstyleRssGeneratorRequest checkstyleRssGeneratorRequest) throws MavenReportException {
VelocityTemplate vtemplate = new VelocityTemplate(velocityComponent, CheckstyleReport.PLUGIN_RESOURCES);
vtemplate.setLog(checkstyleRssGeneratorRequest.getLog());
Context context = new VelocityContext();
context.put("results", results);
context.put("project", checkstyleRssGeneratorRequest.getMavenProject());
context.put("copyright", checkstyleRssGeneratorRequest.getCopyright());
context.put("levelInfo", SeverityLevel.INFO);
context.put("levelWarning", SeverityLevel.WARNING);
context.put("levelError", SeverityLevel.ERROR);
context.put("stringutils", new StringUtils());
try {
vtemplate.generate(checkstyleRssGeneratorRequest.getOutputDirectory().getPath() + "/checkstyle.rss", "checkstyle-rss.vm", context);
} catch (ResourceNotFoundException e) {
throw new MavenReportException("Unable to find checkstyle-rss.vm resource.", e);
} catch (MojoExecutionException | IOException | VelocityException e) {
throw new MavenReportException("Unable to generate checkstyle.rss.", e);
}
}
use of org.codehaus.plexus.util.StringUtils in project maven-plugins by apache.
the class PdfMojo method generatePdf.
/**
* Generate the PDF.
*
* @throws MojoExecutionException if any
* @throws IOException if any
* @since 1.1
*/
private void generatePdf() throws MojoExecutionException, IOException {
Locale.setDefault(getDefaultLocale());
for (final Locale locale : getAvailableLocales()) {
final File workingDir = getLocaleDirectory(workingDirectory, locale);
File siteDirectoryFile = getLocaleDirectory(getSiteDirectoryTmp(), locale);
copyResources(locale);
generateMavenReports(locale);
DocumentRendererContext context = new DocumentRendererContext();
context.put("project", project);
context.put("settings", settings);
context.put("PathTool", new PathTool());
context.put("FileUtils", new FileUtils());
context.put("StringUtils", new StringUtils());
context.put("i18n", i18n);
context.put("generateTOC", generateTOC);
context.put("validate", validate);
// Put any of the properties in directly into the Velocity context
for (Map.Entry<Object, Object> entry : project.getProperties().entrySet()) {
context.put((String) entry.getKey(), entry.getValue());
}
final DocumentModel model = aggregate ? getDocumentModel(locale) : null;
try {
// TODO use interface see DOXIASITETOOLS-30
((AbstractDocumentRenderer) docRenderer).render(siteDirectoryFile, workingDir, model, context);
} catch (DocumentRendererException e) {
throw new MojoExecutionException("Error during document generation: " + e.getMessage(), e);
}
}
}
Aggregations