CommonsDistributionStagingMojo.java

  1. /*
  2.  * Licensed to the Apache Software Foundation (ASF) under one or more
  3.  * contributor license agreements.  See the NOTICE file distributed with
  4.  * this work for additional information regarding copyright ownership.
  5.  * The ASF licenses this file to You under the Apache License, Version 2.0
  6.  * (the "License"); you may not use this file except in compliance with
  7.  * the License.  You may obtain a copy of the License at
  8.  *
  9.  *      http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.apache.commons.release.plugin.mojos;

  18. import java.io.File;
  19. import java.io.IOException;
  20. import java.io.OutputStreamWriter;
  21. import java.io.Writer;
  22. import java.nio.charset.StandardCharsets;
  23. import java.nio.file.Files;
  24. import java.nio.file.Path;
  25. import java.nio.file.Paths;
  26. import java.util.ArrayList;
  27. import java.util.Arrays;
  28. import java.util.List;

  29. import org.apache.commons.io.FileUtils;
  30. import org.apache.commons.io.file.PathUtils;
  31. import org.apache.commons.lang3.StringUtils;
  32. import org.apache.commons.release.plugin.SharedFunctions;
  33. import org.apache.commons.release.plugin.velocity.HeaderHtmlVelocityDelegate;
  34. import org.apache.commons.release.plugin.velocity.ReadmeHtmlVelocityDelegate;
  35. import org.apache.maven.plugin.AbstractMojo;
  36. import org.apache.maven.plugin.MojoExecutionException;
  37. import org.apache.maven.plugin.MojoFailureException;
  38. import org.apache.maven.plugin.logging.Log;
  39. import org.apache.maven.plugins.annotations.Component;
  40. import org.apache.maven.plugins.annotations.LifecyclePhase;
  41. import org.apache.maven.plugins.annotations.Mojo;
  42. import org.apache.maven.plugins.annotations.Parameter;
  43. import org.apache.maven.project.MavenProject;
  44. import org.apache.maven.scm.ScmException;
  45. import org.apache.maven.scm.ScmFileSet;
  46. import org.apache.maven.scm.command.add.AddScmResult;
  47. import org.apache.maven.scm.command.checkin.CheckInScmResult;
  48. import org.apache.maven.scm.command.checkout.CheckOutScmResult;
  49. import org.apache.maven.scm.manager.BasicScmManager;
  50. import org.apache.maven.scm.manager.ScmManager;
  51. import org.apache.maven.scm.provider.ScmProvider;
  52. import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
  53. import org.apache.maven.scm.provider.svn.svnexe.SvnExeScmProvider;
  54. import org.apache.maven.scm.repository.ScmRepository;
  55. import org.apache.maven.settings.Settings;
  56. import org.apache.maven.settings.crypto.SettingsDecrypter;

  57. /**
  58.  * This class checks out the dev distribution location, copies the distributions into that directory
  59.  * structure under the <code>target/commons-release-plugin/scm</code> directory. Then commits the
  60.  * distributions back up to SVN. Also, we include the built and zipped site as well as the RELEASE-NOTES.txt.
  61.  *
  62.  * @since 1.0
  63.  */
  64. @Mojo(name = "stage-distributions",
  65.         defaultPhase = LifecyclePhase.DEPLOY,
  66.         threadSafe = true,
  67.         aggregator = true)
  68. public class CommonsDistributionStagingMojo extends AbstractMojo {

  69.     /** The name of file generated from the README.vm velocity template to be checked into the dist svn repo. */
  70.     private static final String README_FILE_NAME = "README.html";

  71.     /** The name of file generated from the HEADER.vm velocity template to be checked into the dist svn repo. */
  72.     private static final String HEADER_FILE_NAME = "HEADER.html";

  73.     /** The name of the signature validation shell script to be checked into the dist svn repo. */
  74.     private static final String SIGNATURE_VALIDATOR_NAME = "signature-validator.sh";
  75.     /**
  76.      * The {@link MavenProject} object is essentially the context of the maven build at
  77.      * a given time.
  78.      */
  79.     @Parameter(defaultValue = "${project}", required = true)
  80.     private MavenProject project;

  81.     /**
  82.      * The {@link File} that contains a file to the root directory of the working project. Typically
  83.      * this directory is where the <code>pom.xml</code> resides.
  84.      */
  85.     @Parameter(defaultValue = "${basedir}")
  86.     private File baseDir;

  87.     /** The location to which the site gets built during running <code>mvn site</code>. */
  88.     @Parameter(defaultValue = "${project.build.directory}/site", property = "commons.siteOutputDirectory")
  89.     private File siteDirectory;

  90.     /**
  91.      * The main working directory for the plugin, namely <code>target/commons-release-plugin</code>, but
  92.      * that assumes that we're using the default maven <code>${project.build.directory}</code>.
  93.      */
  94.     @Parameter(defaultValue = "${project.build.directory}/commons-release-plugin", property = "commons.outputDirectory")
  95.     private File workingDirectory;

  96.     /**
  97.      * The location to which to check out the dist subversion repository under our working directory, which
  98.      * was given above.
  99.      */
  100.     @Parameter(defaultValue = "${project.build.directory}/commons-release-plugin/scm",
  101.             property = "commons.distCheckoutDirectory")
  102.     private File distCheckoutDirectory;

  103.     /**
  104.      * The location of the RELEASE-NOTES.txt file such that multi-module builds can configure it.
  105.      */
  106.     @Parameter(defaultValue = "${basedir}/RELEASE-NOTES.txt", property = "commons.releaseNotesLocation")
  107.     private File releaseNotesFile;

  108.     /**
  109.      * A boolean that determines whether or not we actually commit the files up to the subversion repository.
  110.      * If this is set to {@code true}, we do all but make the commits. We do checkout the repository in question
  111.      * though.
  112.      */
  113.     @Parameter(property = "commons.release.dryRun", defaultValue = "false")
  114.     private Boolean dryRun;

  115.     /**
  116.      * The url of the subversion repository to which we wish the artifacts to be staged. Typically this would need to
  117.      * be of the form: <code>scm:svn:https://dist.apache.org/repos/dist/dev/commons/foo/version-RC#</code>. Note. that
  118.      * the prefix to the substring <code>https</code> is a requirement.
  119.      */
  120.     @Parameter(defaultValue = "", property = "commons.distSvnStagingUrl")
  121.     private String distSvnStagingUrl;

  122.     /**
  123.      * A parameter to generally avoid running unless it is specifically turned on by the consuming module.
  124.      */
  125.     @Parameter(defaultValue = "false", property = "commons.release.isDistModule")
  126.     private Boolean isDistModule;

  127.     /**
  128.      * The release version of the artifact to be built.
  129.      */
  130.     @Parameter(property = "commons.release.version")
  131.     private String commonsReleaseVersion;

  132.     /**
  133.      * The RC version of the release. For example the first voted on candidate would be "RC1".
  134.      */
  135.     @Parameter(property = "commons.rc.version")
  136.     private String commonsRcVersion;

  137.     /**
  138.      * The ID of the server (specified in settings.xml) which should be used for dist authentication.
  139.      * This will be used in preference to {@link #username}/{@link #password}.
  140.      */
  141.     @Parameter(property = "commons.distServer")
  142.     private String distServer;

  143.     /**
  144.      * The username for the distribution subversion repository. This is typically your Apache id.
  145.      */
  146.     @Parameter(property = "user.name")
  147.     private String username;

  148.     /**
  149.      * The password associated with {@link CommonsDistributionStagingMojo#username}.
  150.      */
  151.     @Parameter(property = "user.password")
  152.     private String password;

  153.     /**
  154.      * Maven {@link Settings}.
  155.      */
  156.     @Parameter(defaultValue = "${settings}", readonly = true, required = true)
  157.     private Settings settings;

  158.     /**
  159.      * Maven {@link SettingsDecrypter} component.
  160.      */
  161.     @Component
  162.     private SettingsDecrypter settingsDecrypter;

  163.     /**
  164.      * A subdirectory of the dist directory into which we are going to stage the release candidate. We
  165.      * build this up in the {@link CommonsDistributionStagingMojo#execute()} method. And, for example,
  166.      * the directory should look like <code>https://dist.apache.org/repos/dist/dev/commons/text/1.4-RC1</code>.
  167.      */
  168.     private File distRcVersionDirectory;

  169.     @Override
  170.     public void execute() throws MojoExecutionException, MojoFailureException {
  171.         if (!isDistModule) {
  172.             getLog().info("This module is marked as a non distribution "
  173.                     + "or assembly module, and the plugin will not run.");
  174.             return;
  175.         }
  176.         if (StringUtils.isEmpty(distSvnStagingUrl)) {
  177.             getLog().warn("commons.distSvnStagingUrl is not set, the commons-release-plugin will not run.");
  178.             return;
  179.         }
  180.         if (!workingDirectory.exists()) {
  181.             getLog().info("Current project contains no distributions. Not executing.");
  182.             return;
  183.         }
  184.         getLog().info("Preparing to stage distributions");
  185.         try {
  186.             final ScmManager scmManager = new BasicScmManager();
  187.             scmManager.setScmProvider("svn", new SvnExeScmProvider());
  188.             final ScmRepository repository = scmManager.makeScmRepository(distSvnStagingUrl);
  189.             final ScmProvider provider = scmManager.getProviderByRepository(repository);
  190.             final SvnScmProviderRepository providerRepository = (SvnScmProviderRepository) repository
  191.                     .getProviderRepository();
  192.             SharedFunctions.setAuthentication(
  193.                     providerRepository,
  194.                     distServer,
  195.                     settings,
  196.                     settingsDecrypter,
  197.                     username,
  198.                     password
  199.             );
  200.             distRcVersionDirectory =
  201.                     new File(distCheckoutDirectory, commonsReleaseVersion + "-" + commonsRcVersion);
  202.             if (!distCheckoutDirectory.exists()) {
  203.                 SharedFunctions.initDirectory(getLog(), distCheckoutDirectory);
  204.             }
  205.             final ScmFileSet scmFileSet = new ScmFileSet(distCheckoutDirectory);
  206.             getLog().info("Checking out dist from: " + distSvnStagingUrl);
  207.             final CheckOutScmResult checkOutResult = provider.checkOut(repository, scmFileSet);
  208.             if (!checkOutResult.isSuccess()) {
  209.                 throw new MojoExecutionException("Failed to checkout files from SCM: "
  210.                         + checkOutResult.getProviderMessage() + " [" + checkOutResult.getCommandOutput() + "]");
  211.             }
  212.             final File copiedReleaseNotes = copyReleaseNotesToWorkingDirectory();
  213.             copyDistributionsIntoScmDirectoryStructureAndAddToSvn(copiedReleaseNotes,
  214.                     provider, repository);
  215.             final List<File> filesToAdd = new ArrayList<>();
  216.             listNotHiddenFilesAndDirectories(distCheckoutDirectory, filesToAdd);
  217.             if (!dryRun) {
  218.                 final ScmFileSet fileSet = new ScmFileSet(distCheckoutDirectory, filesToAdd);
  219.                 final AddScmResult addResult = provider.add(
  220.                         repository,
  221.                         fileSet
  222.                 );
  223.                 if (!addResult.isSuccess()) {
  224.                     throw new MojoExecutionException("Failed to add files to SCM: " + addResult.getProviderMessage()
  225.                             + " [" + addResult.getCommandOutput() + "]");
  226.                 }
  227.                 getLog().info("Staging release: " + project.getArtifactId() + ", version: " + project.getVersion());
  228.                 final CheckInScmResult checkInResult = provider.checkIn(
  229.                         repository,
  230.                         fileSet,
  231.                         "Staging release: " + project.getArtifactId() + ", version: " + project.getVersion()
  232.                 );
  233.                 if (!checkInResult.isSuccess()) {
  234.                     getLog().error("Committing dist files failed: " + checkInResult.getCommandOutput());
  235.                     throw new MojoExecutionException(
  236.                             "Committing dist files failed: " + checkInResult.getCommandOutput()
  237.                     );
  238.                 }
  239.                 getLog().info("Committed revision " + checkInResult.getScmRevision());
  240.             } else {
  241.                 getLog().info("[Dry run] Would have committed to: " + distSvnStagingUrl);
  242.                 getLog().info(
  243.                         "[Dry run] Staging release: " + project.getArtifactId() + ", version: " + project.getVersion());
  244.             }
  245.         } catch (final ScmException e) {
  246.             getLog().error("Could not commit files to dist: " + distSvnStagingUrl, e);
  247.             throw new MojoExecutionException("Could not commit files to dist: " + distSvnStagingUrl, e);
  248.         }
  249.     }

  250.     /**
  251.      * Lists all directories and files to a flat list.
  252.      * @param directory {@link File} containing directory to list
  253.      * @param files a {@link List} of {@link File} to which to append the files.
  254.      */
  255.     private void listNotHiddenFilesAndDirectories(final File directory, final List<File> files) {
  256.         // Get all the files and directories from a directory.
  257.         final File[] fList = directory.listFiles();
  258.         for (final File file : fList) {
  259.             if (file.isFile() && !file.isHidden()) {
  260.                 files.add(file);
  261.             } else if (file.isDirectory() && !file.isHidden()) {
  262.                 files.add(file);
  263.                 listNotHiddenFilesAndDirectories(file, files);
  264.             }
  265.         }
  266.     }

  267.     /**
  268.      * A utility method that takes the <code>RELEASE-NOTES.txt</code> file from the base directory of the
  269.      * project and copies it into {@link CommonsDistributionStagingMojo#workingDirectory}.
  270.      *
  271.      * @return the RELEASE-NOTES.txt file that exists in the <code>target/commons-release-notes/scm</code>
  272.      *         directory for the purpose of adding it to the scm change set in the method
  273.      *         {@link CommonsDistributionStagingMojo#copyDistributionsIntoScmDirectoryStructureAndAddToSvn(File,
  274.      *         ScmProvider, ScmRepository)}.
  275.      * @throws MojoExecutionException if an {@link IOException} occurs as a wrapper so that maven
  276.      *                                can properly handle the exception.
  277.      */
  278.     private File copyReleaseNotesToWorkingDirectory() throws MojoExecutionException {
  279.         SharedFunctions.initDirectory(getLog(), distRcVersionDirectory);
  280.         getLog().info("Copying RELEASE-NOTES.txt to working directory.");
  281.         final File copiedReleaseNotes = new File(distRcVersionDirectory, releaseNotesFile.getName());
  282.         SharedFunctions.copyFile(getLog(), releaseNotesFile, copiedReleaseNotes);
  283.         return copiedReleaseNotes;
  284.     }

  285.     /**
  286.      * Copies the list of files at the root of the {@link CommonsDistributionStagingMojo#workingDirectory} into
  287.      * the directory structure of the distribution staging repository. Specifically:
  288.      * <ul>
  289.      *   <li>root:
  290.      *     <ul>
  291.      *         <li>site</li>
  292.      *         <li>site.zip</li>
  293.      *         <li>RELEASE-NOTES.txt</li>
  294.      *         <li>source:
  295.      *           <ul>
  296.      *             <li>-src artifacts....</li>
  297.      *           </ul>
  298.      *         </li>
  299.      *         <li>binaries:
  300.      *           <ul>
  301.      *             <li>-bin artifacts....</li>
  302.      *           </ul>
  303.      *         </li>
  304.      *     </ul>
  305.      *   </li>
  306.      * </ul>
  307.      *
  308.      * @param copiedReleaseNotes is the RELEASE-NOTES.txt file that exists in the
  309.      *                           <code>target/commons-release-plugin/scm</code> directory.
  310.      * @param provider is the {@link ScmProvider} that we will use for adding the files we wish to commit.
  311.      * @param repository is the {@link ScmRepository} that we will use for adding the files that we wish to commit.
  312.      * @return a {@link List} of {@link File}'s in the directory for the purpose of adding them to the maven
  313.      *         {@link ScmFileSet}.
  314.      * @throws MojoExecutionException if an {@link IOException} occurs so that Maven can handle it properly.
  315.      */
  316.     private List<File> copyDistributionsIntoScmDirectoryStructureAndAddToSvn(final File copiedReleaseNotes,
  317.                                                                              final ScmProvider provider,
  318.                                                                              final ScmRepository repository)
  319.             throws MojoExecutionException {
  320.         final List<File> workingDirectoryFiles = Arrays.asList(workingDirectory.listFiles());
  321.         final List<File> filesForMavenScmFileSet = new ArrayList<>();
  322.         final File scmBinariesRoot = new File(distRcVersionDirectory, "binaries");
  323.         final File scmSourceRoot = new File(distRcVersionDirectory, "source");
  324.         SharedFunctions.initDirectory(getLog(), scmBinariesRoot);
  325.         SharedFunctions.initDirectory(getLog(), scmSourceRoot);
  326.         File copy;
  327.         for (final File file : workingDirectoryFiles) {
  328.             if (file.getName().contains("src")) {
  329.                 copy = new File(scmSourceRoot,  file.getName());
  330.                 SharedFunctions.copyFile(getLog(), file, copy);
  331.                 filesForMavenScmFileSet.add(file);
  332.             } else if (file.getName().contains("bin")) {
  333.                 copy = new File(scmBinariesRoot,  file.getName());
  334.                 SharedFunctions.copyFile(getLog(), file, copy);
  335.                 filesForMavenScmFileSet.add(file);
  336.             } else if (StringUtils.containsAny(file.getName(), "scm", "sha256.properties", "sha512.properties")) {
  337.                 getLog().debug("Not copying scm directory over to the scm directory because it is the scm directory.");
  338.                 //do nothing because we are copying into scm
  339.             } else {
  340.                 copy = new File(distCheckoutDirectory.getAbsolutePath(),  file.getName());
  341.                 SharedFunctions.copyFile(getLog(), file, copy);
  342.                 filesForMavenScmFileSet.add(file);
  343.             }
  344.         }
  345.         filesForMavenScmFileSet.addAll(buildReadmeAndHeaderHtmlFiles());
  346.         filesForMavenScmFileSet.add(copySignatureValidatorScriptToScmDirectory());
  347.         filesForMavenScmFileSet.addAll(copySiteToScmDirectory());
  348.         return filesForMavenScmFileSet;
  349.     }

  350.     /**
  351.      * Copies our <code>signature-validator.sh</code> script into
  352.      * <code>${basedir}/target/commons-release-plugin/scm/signature-validator.sh</code>.
  353.      *
  354.      * @return the {@link File} for the signature-validator.sh
  355.      * @throws MojoExecutionException if an error occurs while the resource is being copied
  356.      */
  357.     private File copySignatureValidatorScriptToScmDirectory() throws MojoExecutionException {
  358.         final Path scmTargetPath = Paths.get(distRcVersionDirectory.toString(), SIGNATURE_VALIDATOR_NAME);
  359.         final String name = "/resources/" + SIGNATURE_VALIDATOR_NAME;
  360.         // The source can be in a local file or inside a jar file.
  361.         try {
  362.             PathUtils.copyFile(getClass().getResource(name), scmTargetPath);
  363.         } catch (final Exception e) {
  364.             throw new MojoExecutionException(String.format("Failed to copy '%s' to '%s'", name, scmTargetPath), e);
  365.         }
  366.         return scmTargetPath.toFile();
  367.     }

  368.     /**
  369.      * Copies <code>${basedir}/target/site</code> to <code>${basedir}/target/commons-release-plugin/scm/site</code>.
  370.      *
  371.      * @return the {@link List} of {@link File}'s contained in
  372.      *         <code>${basedir}/target/commons-release-plugin/scm/site</code>, after the copy is complete.
  373.      * @throws MojoExecutionException if the site copying fails for some reason.
  374.      */
  375.     private List<File> copySiteToScmDirectory() throws MojoExecutionException {
  376.         if (!siteDirectory.exists()) {
  377.             getLog().error("\"mvn site\" was not run before this goal, or a siteDirectory did not exist.");
  378.             throw new MojoExecutionException(
  379.                     "\"mvn site\" was not run before this goal, or a siteDirectory did not exist."
  380.             );
  381.         }
  382.         final File siteInScm = new File(distRcVersionDirectory, "site");
  383.         try {
  384.             FileUtils.copyDirectory(siteDirectory, siteInScm);
  385.         } catch (final IOException e) {
  386.             throw new MojoExecutionException("Site copying failed", e);
  387.         }
  388.         return new ArrayList<>(FileUtils.listFiles(siteInScm, null, true));
  389.     }

  390.     /**
  391.      * Builds up <code>README.html</code> and <code>HEADER.html</code> that reside in following.
  392.      * <ul>
  393.      *     <li>distRoot
  394.      *     <ul>
  395.      *         <li>binaries/HEADER.html (symlink)</li>
  396.      *         <li>binaries/README.html (symlink)</li>
  397.      *         <li>source/HEADER.html (symlink)</li>
  398.      *         <li>source/README.html (symlink)</li>
  399.      *         <li>HEADER.html</li>
  400.      *         <li>README.html</li>
  401.      *     </ul>
  402.      *     </li>
  403.      * </ul>
  404.      * @return the {@link List} of created files above
  405.      * @throws MojoExecutionException if an {@link IOException} occurs in the creation of these
  406.      *                                files fails.
  407.      */
  408.     private List<File> buildReadmeAndHeaderHtmlFiles() throws MojoExecutionException {
  409.         final List<File> headerAndReadmeFiles = new ArrayList<>();
  410.         final File headerFile = new File(distRcVersionDirectory, HEADER_FILE_NAME);
  411.         //
  412.         // HEADER file
  413.         //
  414.         try (Writer headerWriter = new OutputStreamWriter(Files.newOutputStream(headerFile.toPath()),
  415.                 StandardCharsets.UTF_8)) {
  416.             HeaderHtmlVelocityDelegate.builder().build().render(headerWriter);
  417.         } catch (final IOException e) {
  418.             final String message = "Could not build HEADER html file " + headerFile;
  419.             getLog().error(message, e);
  420.             throw new MojoExecutionException(message, e);
  421.         }
  422.         headerAndReadmeFiles.add(headerFile);
  423.         //
  424.         // README file
  425.         //
  426.         final File readmeFile = new File(distRcVersionDirectory, README_FILE_NAME);
  427.         try (Writer readmeWriter = new OutputStreamWriter(Files.newOutputStream(readmeFile.toPath()),
  428.                 StandardCharsets.UTF_8)) {
  429.             // @formatter:off
  430.             final ReadmeHtmlVelocityDelegate readmeHtmlVelocityDelegate = ReadmeHtmlVelocityDelegate.builder()
  431.                     .withArtifactId(project.getArtifactId())
  432.                     .withVersion(project.getVersion())
  433.                     .withSiteUrl(project.getUrl())
  434.                     .build();
  435.             // @formatter:on
  436.             readmeHtmlVelocityDelegate.render(readmeWriter);
  437.         } catch (final IOException e) {
  438.             final String message = "Could not build README html file " + readmeFile;
  439.             getLog().error(message, e);
  440.             throw new MojoExecutionException(message, e);
  441.         }
  442.         headerAndReadmeFiles.add(readmeFile);
  443.         //
  444.         // signature-validator.sh file copy
  445.         //
  446.         headerAndReadmeFiles.addAll(copyHeaderAndReadmeToSubdirectories(headerFile, readmeFile));
  447.         return headerAndReadmeFiles;
  448.     }

  449.     /**
  450.      * Copies <code>README.html</code> and <code>HEADER.html</code> to the source and binaries
  451.      * directories.
  452.      *
  453.      * @param headerFile The originally created <code>HEADER.html</code> file.
  454.      * @param readmeFile The originally created <code>README.html</code> file.
  455.      * @return a {@link List} of created files.
  456.      * @throws MojoExecutionException if the {@link SharedFunctions#copyFile(Log, File, File)}
  457.      *                                fails.
  458.      */
  459.     private List<File> copyHeaderAndReadmeToSubdirectories(final File headerFile, final File readmeFile)
  460.             throws MojoExecutionException {
  461.         final List<File> symbolicLinkFiles = new ArrayList<>();
  462.         final File sourceRoot = new File(distRcVersionDirectory, "source");
  463.         final File binariesRoot = new File(distRcVersionDirectory, "binaries");
  464.         final File sourceHeaderFile = new File(sourceRoot, HEADER_FILE_NAME);
  465.         final File sourceReadmeFile = new File(sourceRoot, README_FILE_NAME);
  466.         final File binariesHeaderFile = new File(binariesRoot, HEADER_FILE_NAME);
  467.         final File binariesReadmeFile = new File(binariesRoot, README_FILE_NAME);
  468.         SharedFunctions.copyFile(getLog(), headerFile, sourceHeaderFile);
  469.         symbolicLinkFiles.add(sourceHeaderFile);
  470.         SharedFunctions.copyFile(getLog(), readmeFile, sourceReadmeFile);
  471.         symbolicLinkFiles.add(sourceReadmeFile);
  472.         SharedFunctions.copyFile(getLog(), headerFile, binariesHeaderFile);
  473.         symbolicLinkFiles.add(binariesHeaderFile);
  474.         SharedFunctions.copyFile(getLog(), readmeFile, binariesReadmeFile);
  475.         symbolicLinkFiles.add(binariesReadmeFile);
  476.         return symbolicLinkFiles;
  477.     }

  478.     /**
  479.      * This method is the setter for the {@link CommonsDistributionStagingMojo#baseDir} field, specifically
  480.      * for the usage in the unit tests.
  481.      *
  482.      * @param baseDir is the {@link File} to be used as the project's root directory when this mojo
  483.      *                is invoked.
  484.      */
  485.     protected void setBaseDir(final File baseDir) {
  486.         this.baseDir = baseDir;
  487.     }
  488. }