Skip to content
Permalink
Browse files
Refactor duplicate strings.
  • Loading branch information
garydgregory committed May 30, 2018
1 parent 3640852 commit 6491f51f4c165c1e9e2fcaf2a4d536c4b3955834
Showing 1 changed file with 10 additions and 6 deletions.
@@ -61,6 +61,10 @@
aggregator = true)
public class CommonsDistributionStagingMojo extends AbstractMojo {

private static final String README_FILE_NAME = "README.html";

private static final String HEADER_FILE_NAME = "HEADER.html";

/**
* The {@link MavenProject} object is essentially the context of the maven build at
* a given time.
@@ -296,7 +300,7 @@ private List<File> copyDistributionsIntoScmDirectoryStructure(File copiedRelease
*/
private List<File> buildReadmeAndHeaderHtmlFiles() throws MojoExecutionException {
List<File> headerAndReadmeFiles = new ArrayList<>();
File headerFile = new File(distCheckoutDirectory, "HEADER.html");
File headerFile = new File(distCheckoutDirectory, HEADER_FILE_NAME);
//
// HEADER file
//
@@ -311,7 +315,7 @@ private List<File> buildReadmeAndHeaderHtmlFiles() throws MojoExecutionException
//
// README file
//
File readmeFile = new File(distCheckoutDirectory, "README.html");
File readmeFile = new File(distCheckoutDirectory, README_FILE_NAME);
try (Writer readmeWriter = new OutputStreamWriter(new FileOutputStream(readmeFile), "UTF-8")) {
// @formatter:off
ReadmeHtmlVelocityDelegate readmeHtmlVelocityDelegate = ReadmeHtmlVelocityDelegate.builder()
@@ -346,10 +350,10 @@ private List<File> copyHeaderAndReadmeToSubdirectories(File headerFile, File rea
List<File> symbolicLinkFiles = new ArrayList<>();
File sourceRoot = new File(buildDistSourceRoot());
File binariesRoot = new File(buildDistBinariesRoot());
File sourceHeaderFile = new File(sourceRoot, "HEADER.html");
File sourceReadmeFile = new File(sourceRoot, "README.html");
File binariesHeaderFile = new File(binariesRoot, "HEADER.html");
File binariesReadmeFile = new File(binariesRoot, "README.html");
File sourceHeaderFile = new File(sourceRoot, HEADER_FILE_NAME);
File sourceReadmeFile = new File(sourceRoot, README_FILE_NAME);
File binariesHeaderFile = new File(binariesRoot, HEADER_FILE_NAME);
File binariesReadmeFile = new File(binariesRoot, README_FILE_NAME);
SharedFunctions.copyFile(getLog(), headerFile, sourceHeaderFile);
symbolicLinkFiles.add(sourceHeaderFile);
SharedFunctions.copyFile(getLog(), readmeFile, sourceReadmeFile);

0 comments on commit 6491f51

Please sign in to comment.