in src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojo.java [217:257]
private List<File> buildReadmeAndHeaderHtmlFiles() throws MojoExecutionException {
final List<File> headerAndReadmeFiles = new ArrayList<>();
final File headerFile = new File(distRcVersionDirectory, HEADER_FILE_NAME);
//
// HEADER file
//
try (Writer headerWriter = new OutputStreamWriter(Files.newOutputStream(headerFile.toPath()),
StandardCharsets.UTF_8)) {
HeaderHtmlVelocityDelegate.builder().build().render(headerWriter);
} catch (final IOException e) {
final String message = "Could not build HEADER html file " + headerFile;
getLog().error(message, e);
throw new MojoExecutionException(message, e);
}
headerAndReadmeFiles.add(headerFile);
//
// README file
//
final File readmeFile = new File(distRcVersionDirectory, README_FILE_NAME);
try (Writer readmeWriter = new OutputStreamWriter(Files.newOutputStream(readmeFile.toPath()),
StandardCharsets.UTF_8)) {
// @formatter:off
final ReadmeHtmlVelocityDelegate readmeHtmlVelocityDelegate = ReadmeHtmlVelocityDelegate.builder()
.withArtifactId(project.getArtifactId())
.withVersion(project.getVersion())
.withSiteUrl(project.getUrl())
.build();
// @formatter:on
readmeHtmlVelocityDelegate.render(readmeWriter);
} catch (final IOException e) {
final String message = "Could not build README html file " + readmeFile;
getLog().error(message, e);
throw new MojoExecutionException(message, e);
}
headerAndReadmeFiles.add(readmeFile);
//
// signature-validator.sh file copy
//
headerAndReadmeFiles.addAll(copyHeaderAndReadmeToSubdirectories(headerFile, readmeFile));
return headerAndReadmeFiles;
}