use of org.codehaus.plexus.util.xml.PrettyPrintXMLWriter in project maven-plugins by apache.
the class EffectiveSiteMojo method execute.
/**
* {@inheritDoc}
*/
public void execute() throws MojoExecutionException, MojoFailureException {
DecorationModel decorationModel = prepareDecorationModel(getLocales().get(0));
StringWriter w = new StringWriter();
XMLWriter writer = new PrettyPrintXMLWriter(w, StringUtils.repeat(" ", XmlWriterUtil.DEFAULT_INDENTATION_SIZE), decorationModel.getModelEncoding(), null);
writeHeader(writer);
writeEffectiveSite(decorationModel, writer);
String effectiveSite = w.toString();
if (output != null) {
try {
writeXmlFile(output, effectiveSite);
} catch (IOException e) {
throw new MojoExecutionException("Cannot write effective site descriptor to output: " + output, e);
}
if (getLog().isInfoEnabled()) {
getLog().info("Effective site descriptor written to: " + output);
}
} else {
StringBuilder message = new StringBuilder();
message.append("\nEffective site descriptor, after inheritance and interpolation:\n\n");
message.append(effectiveSite);
message.append("\n");
if (getLog().isInfoEnabled()) {
getLog().info(message.toString());
}
}
}
Aggregations