You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@commons.apache.org by ch...@apache.org on 2018/06/19 03:50:26 UTC

svn commit: r1031439 [15/23] - in /websites/production/commons/content/proper/commons-release-plugin: ./ apidocs/ apidocs/org/apache/commons/release/plugin/ apidocs/org/apache/commons/release/plugin/class-use/ apidocs/org/apache/commons/release/plugin/...

Modified: websites/production/commons/content/proper/commons-release-plugin/jacoco/org.apache.commons.release.plugin.mojos/CommonsDistributionDetachmentMojo.java.html
==============================================================================
--- websites/production/commons/content/proper/commons-release-plugin/jacoco/org.apache.commons.release.plugin.mojos/CommonsDistributionDetachmentMojo.java.html (original)
+++ websites/production/commons/content/proper/commons-release-plugin/jacoco/org.apache.commons.release.plugin.mojos/CommonsDistributionDetachmentMojo.java.html Tue Jun 19 03:50:24 2018
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="iso-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>CommonsDistributionDetachmentMojo.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Commons Release Plugin</a> &gt; <a href="index.source.html" class="el_package">org.apache.commons.release.p
 lugin.mojos</a> &gt; <span class="el_source">CommonsDistributionDetachmentMojo.java</span></div><h1>CommonsDistributionDetachmentMojo.java</h1><pre class="source lang-java linenums">/*
+<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>CommonsDistributionDetachmentMojo.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Commons Release Plugin</a> &gt; <a href="index.source.html" class="el_package">org.apache.commons.release.p
 lugin.mojos</a> &gt; <span class="el_source">CommonsDistributionDetachmentMojo.java</span></div><h1>CommonsDistributionDetachmentMojo.java</h1><pre class="source lang-java linenums">/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -16,6 +16,18 @@
  */
 package org.apache.commons.release.plugin.mojos;
 
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
 import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.release.plugin.SharedFunctions;
@@ -27,20 +39,10 @@ import org.apache.maven.plugins.annotati
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.project.MavenProject;
 
-import java.io.File;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
 /**
- * The purpose of this maven mojo is to detach the artifacts generated by the maven-assembly-plugin,
+ * The purpose of this Maven mojo is to detach the artifacts generated by the maven-assembly-plugin,
  * which for the Apache Commons Project do not get uploaded to Nexus, and putting those artifacts
- * in the dev distribution location for apache projects.
+ * in the dev distribution location for Apache projects.
  *
  * @author chtompki
  * @since 1.0
@@ -49,10 +51,10 @@ import java.util.Set;
         defaultPhase = LifecyclePhase.VERIFY,
         threadSafe = true,
         aggregator = true)
-<span class="fc" id="L52">public class CommonsDistributionDetachmentMojo extends AbstractMojo {</span>
+<span class="fc" id="L54">public class CommonsDistributionDetachmentMojo extends AbstractMojo {</span>
 
     /**
-     * A list of &quot;artifact types&quot; in the maven vernacular, to
+     * A list of &quot;artifact types&quot; in the Maven vernacular, to
      * be detached from the deployment. For the time being we want
      * all artifacts generated by the maven-assembly-plugin to be detached
      * from the deployment, namely *-src.zip, *-src.tar.gz, *-bin.zip,
@@ -60,19 +62,33 @@ import java.util.Set;
      */
     private static final Set&lt;String&gt; ARTIFACT_TYPES_TO_DETACH;
     static {
-<span class="fc" id="L63">        Set&lt;String&gt; hashSet = new HashSet&lt;&gt;();</span>
-<span class="fc" id="L64">        hashSet.add(&quot;zip&quot;);</span>
-<span class="fc" id="L65">        hashSet.add(&quot;tar.gz&quot;);</span>
-<span class="fc" id="L66">        hashSet.add(&quot;zip.asc&quot;);</span>
-<span class="fc" id="L67">        hashSet.add(&quot;tar.gz.asc&quot;);</span>
-<span class="fc" id="L68">        ARTIFACT_TYPES_TO_DETACH = Collections.unmodifiableSet(hashSet);</span>
-<span class="fc" id="L69">    }</span>
+<span class="fc" id="L65">        Set&lt;String&gt; hashSet = new HashSet&lt;&gt;();</span>
+<span class="fc" id="L66">        hashSet.add(&quot;zip&quot;);</span>
+<span class="fc" id="L67">        hashSet.add(&quot;tar.gz&quot;);</span>
+<span class="fc" id="L68">        hashSet.add(&quot;zip.asc&quot;);</span>
+<span class="fc" id="L69">        hashSet.add(&quot;tar.gz.asc&quot;);</span>
+<span class="fc" id="L70">        ARTIFACT_TYPES_TO_DETACH = Collections.unmodifiableSet(hashSet);</span>
+<span class="fc" id="L71">    }</span>
+
+    /**
+     * This list is supposed to hold the Maven references to the aforementioned artifacts so that we
+     * can upload them to svn after they've been detached from the Maven deployment.
+     */
+<span class="fc" id="L77">    private final List&lt;Artifact&gt; detachedArtifacts = new ArrayList&lt;&gt;();</span>
 
     /**
-     * This list is supposed to hold the maven references to the aformentioned artifacts so that we
-     * can upload them to svn after they've been detached from the maven deployment.
+     * A {@link Properties} of {@link Artifact} → {@link String} containing the sha1 signatures
+     * for the individual artifacts, where the {@link Artifact} is represented as:
+     * &lt;code&gt;groupId:artifactId:version:type=sha1&lt;/code&gt;.
      */
-<span class="fc" id="L75">    private List&lt;Artifact&gt; detachedArtifacts = new ArrayList&lt;&gt;();</span>
+<span class="fc" id="L84">    private final Properties artifactSha1s = new Properties();</span>
+
+    /**
+     * A {@link Properties} of {@link Artifact} → {@link String} containing the sha256 signatures
+     * for the individual artifacts, where the {@link Artifact} is represented as:
+     * &lt;code&gt;groupId:artifactId:version:type=sha1&lt;/code&gt;.
+     */
+<span class="fc" id="L91">    private final Properties artifactSha256s = new Properties();</span>
 
     /**
      * The maven project context injection so that we can get a hold of the variables at hand.
@@ -101,114 +117,241 @@ import java.util.Set;
 
     @Override
     public void execute() throws MojoExecutionException {
-<span class="pc bpc" id="L104" title="1 of 2 branches missed.">        if (!isDistModule) {</span>
-<span class="nc" id="L105">            getLog().info(&quot;This module is marked as a non distribution &quot;</span>
+<span class="pc bpc" id="L120" title="1 of 2 branches missed.">        if (!isDistModule) {</span>
+<span class="nc" id="L121">            getLog().info(&quot;This module is marked as a non distribution &quot;</span>
                     + &quot;or assembly module, and the plugin will not run.&quot;);
-<span class="nc" id="L107">            return;</span>
+<span class="nc" id="L123">            return;</span>
         }
-<span class="fc bfc" id="L109" title="All 2 branches covered.">        if (StringUtils.isEmpty(distSvnStagingUrl)) {</span>
-<span class="fc" id="L110">            getLog().warn(&quot;commons.distSvnStagingUrl is not set, the commons-release-plugin will not run.&quot;);</span>
-<span class="fc" id="L111">            return;</span>
+<span class="fc bfc" id="L125" title="All 2 branches covered.">        if (StringUtils.isEmpty(distSvnStagingUrl)) {</span>
+<span class="fc" id="L126">            getLog().warn(&quot;commons.distSvnStagingUrl is not set, the commons-release-plugin will not run.&quot;);</span>
+<span class="fc" id="L127">            return;</span>
         }
-<span class="fc" id="L113">        getLog().info(&quot;Detaching Assemblies&quot;);</span>
-<span class="fc bfc" id="L114" title="All 2 branches covered.">        for (Object attachedArtifact : project.getAttachedArtifacts()) {</span>
-<span class="fc bfc" id="L115" title="All 2 branches covered.">            if (ARTIFACT_TYPES_TO_DETACH.contains(((Artifact) attachedArtifact).getType())) {</span>
-<span class="fc" id="L116">                detachedArtifacts.add((Artifact) attachedArtifact);</span>
+<span class="fc" id="L129">        getLog().info(&quot;Detaching Assemblies&quot;);</span>
+<span class="fc bfc" id="L130" title="All 2 branches covered.">        for (Object attachedArtifact : project.getAttachedArtifacts()) {</span>
+<span class="fc" id="L131">            putAttachedArtifactInSha1Map((Artifact) attachedArtifact);</span>
+<span class="fc" id="L132">            putAttachedArtifactInSha256Map((Artifact) attachedArtifact);</span>
+<span class="fc bfc" id="L133" title="All 2 branches covered.">            if (ARTIFACT_TYPES_TO_DETACH.contains(((Artifact) attachedArtifact).getType())) {</span>
+<span class="fc" id="L134">                detachedArtifacts.add((Artifact) attachedArtifact);</span>
             }
-<span class="fc" id="L118">        }</span>
-<span class="pc bpc" id="L119" title="1 of 2 branches missed.">        if (detachedArtifacts.isEmpty()) {</span>
-<span class="nc" id="L120">            getLog().info(&quot;Current project contains no distributions. Not executing.&quot;);</span>
-<span class="nc" id="L121">            return;</span>
+<span class="fc" id="L136">        }</span>
+<span class="pc bpc" id="L137" title="1 of 2 branches missed.">        if (detachedArtifacts.isEmpty()) {</span>
+<span class="nc" id="L138">            getLog().info(&quot;Current project contains no distributions. Not executing.&quot;);</span>
+<span class="nc" id="L139">            return;</span>
         }
-<span class="fc bfc" id="L123" title="All 2 branches covered.">        for (Artifact artifactToRemove : detachedArtifacts) {</span>
-<span class="fc" id="L124">            project.getAttachedArtifacts().remove(artifactToRemove);</span>
-<span class="fc" id="L125">        }</span>
-<span class="pc bpc" id="L126" title="1 of 2 branches missed.">        if (!workingDirectory.exists()) {</span>
-<span class="fc" id="L127">            SharedFunctions.initDirectory(getLog(), workingDirectory);</span>
+<span class="fc bfc" id="L141" title="All 2 branches covered.">        for (Artifact artifactToRemove : detachedArtifacts) {</span>
+<span class="fc" id="L142">            project.getAttachedArtifacts().remove(artifactToRemove);</span>
+<span class="fc" id="L143">        }</span>
+<span class="pc bpc" id="L144" title="1 of 2 branches missed.">        if (!workingDirectory.exists()) {</span>
+<span class="fc" id="L145">            SharedFunctions.initDirectory(getLog(), workingDirectory);</span>
         }
-<span class="fc" id="L129">        copyRemovedArtifactsToWorkingDirectory();</span>
-<span class="fc" id="L130">        getLog().info(&quot;&quot;);</span>
-<span class="fc" id="L131">        sha1AndMd5SignArtifacts();</span>
-<span class="fc" id="L132">    }</span>
+<span class="fc" id="L147">        writeAllArtifactsInSha1PropertiesFile();</span>
+<span class="fc" id="L148">        writeAllArtifactsInSha256PropertiesFile();</span>
+<span class="fc" id="L149">        copyRemovedArtifactsToWorkingDirectory();</span>
+<span class="fc" id="L150">        getLog().info(&quot;&quot;);</span>
+<span class="fc" id="L151">        hashArtifacts();</span>
+<span class="fc" id="L152">    }</span>
+
+    /**
+     * Takes an attached artifact and puts the signature in the map.
+     * @param artifact is a Maven {@link Artifact} taken from the project at start time of mojo.
+     * @throws MojoExecutionException if an {@link IOException} occurs when getting the sha1 of the
+     *                                artifact.
+     */
+    private void putAttachedArtifactInSha1Map(Artifact artifact) throws MojoExecutionException {
+        try {
+<span class="fc" id="L162">            String artifactKey = getArtifactKey(artifact);</span>
+<span class="fc" id="L163">            try (FileInputStream fis = new FileInputStream(artifact.getFile())) {</span>
+<span class="fc" id="L164">                artifactSha1s.put(artifactKey, DigestUtils.sha1Hex(fis));</span>
+            }
+<span class="nc" id="L166">        } catch (IOException e) {</span>
+<span class="nc" id="L167">            throw new MojoExecutionException(</span>
+                &quot;Could not find artifact signature for: &quot;
+<span class="nc" id="L169">                    + artifact.getArtifactId()</span>
+                    + &quot;-&quot;
+<span class="nc" id="L171">                    + artifact.getClassifier()</span>
+                    + &quot;-&quot;
+<span class="nc" id="L173">                    + artifact.getVersion()</span>
+                    + &quot; type: &quot;
+<span class="nc" id="L175">                    + artifact.getType(),</span>
+                e);
+<span class="fc" id="L177">        }</span>
+<span class="fc" id="L178">    }</span>
+
+    /**
+     * Takes an attached artifact and puts the signature in the map.
+     * @param artifact is a Maven {@link Artifact} taken from the project at start time of mojo.
+     * @throws MojoExecutionException if an {@link IOException} occurs when getting the sha1 of the
+     *                                artifact.
+     */
+    private void putAttachedArtifactInSha256Map(Artifact artifact) throws MojoExecutionException {
+        try {
+<span class="fc" id="L188">            String artifactKey = getArtifactKey(artifact);</span>
+<span class="fc" id="L189">            try (FileInputStream fis = new FileInputStream(artifact.getFile())) {</span>
+<span class="fc" id="L190">                artifactSha256s.put(artifactKey, DigestUtils.sha256Hex(fis));</span>
+            }
+<span class="nc" id="L192">        } catch (IOException e) {</span>
+<span class="nc" id="L193">            throw new MojoExecutionException(</span>
+                &quot;Could not find artifact signature for: &quot;
+<span class="nc" id="L195">                    + artifact.getArtifactId()</span>
+                    + &quot;-&quot;
+<span class="nc" id="L197">                    + artifact.getClassifier()</span>
+                    + &quot;-&quot;
+<span class="nc" id="L199">                    + artifact.getVersion()</span>
+                    + &quot; type: &quot;
+<span class="nc" id="L201">                    + artifact.getType(),</span>
+                e);
+<span class="fc" id="L203">        }</span>
+<span class="fc" id="L204">    }</span>
+
+    /**
+     * Writes to ./target/commons-release-plugin/sha1.properties the artifact sha1's.
+     *
+     * @throws MojoExecutionException if we can't write the file due to an {@link IOException}.
+     */
+    private void writeAllArtifactsInSha1PropertiesFile() throws MojoExecutionException {
+<span class="fc" id="L212">        File propertiesFile = new File(workingDirectory, &quot;sha1.properties&quot;);</span>
+<span class="fc" id="L213">        getLog().info(&quot;Writting &quot; + propertiesFile);</span>
+<span class="fc" id="L214">        try (FileOutputStream fileWriter = new FileOutputStream(propertiesFile)) {</span>
+<span class="fc" id="L215">            artifactSha1s.store(fileWriter, &quot;Release SHA-1s&quot;);</span>
+<span class="nc" id="L216">        } catch (IOException e) {</span>
+<span class="nc" id="L217">            throw new MojoExecutionException(&quot;Failure to write SHA-1's&quot;, e);</span>
+<span class="fc" id="L218">        }</span>
+<span class="fc" id="L219">    }</span>
+
+    /**
+     * Writes to ./target/commons-release-plugin/sha256.properties the artifact sha256's.
+     *
+     * @throws MojoExecutionException if we can't write the file due to an {@link IOException}.
+     */
+    private void writeAllArtifactsInSha256PropertiesFile() throws MojoExecutionException {
+<span class="fc" id="L227">        File propertiesFile = new File(workingDirectory, &quot;sha256.properties&quot;);</span>
+<span class="fc" id="L228">        getLog().info(&quot;Writting &quot; + propertiesFile);</span>
+<span class="fc" id="L229">        try (FileOutputStream fileWriter = new FileOutputStream(propertiesFile)) {</span>
+<span class="fc" id="L230">            artifactSha256s.store(fileWriter, &quot;Release SHA-256s&quot;);</span>
+<span class="nc" id="L231">        } catch (IOException e) {</span>
+<span class="nc" id="L232">            throw new MojoExecutionException(&quot;Failure to write SHA-256's&quot;, e);</span>
+<span class="fc" id="L233">        }</span>
+<span class="fc" id="L234">    }</span>
 
     /**
      * A helper method to copy the newly detached artifacts to &lt;code&gt;target/commons-release-plugin&lt;/code&gt;
      * so that the {@link CommonsDistributionStagingMojo} can find the artifacts later.
      *
      * @throws MojoExecutionException if some form of an {@link IOException} occurs, we want it
-     *                                properly wrapped so that maven can handle it.
+     *                                properly wrapped so that Maven can handle it.
      */
     private void copyRemovedArtifactsToWorkingDirectory() throws MojoExecutionException {
         StringBuffer copiedArtifactAbsolutePath;
-<span class="fc" id="L143">        getLog().info(&quot;Copying detached artifacts to working directory.&quot;);</span>
-<span class="fc bfc" id="L144" title="All 2 branches covered.">        for (Artifact artifact: detachedArtifacts) {</span>
-<span class="fc" id="L145">            File artifactFile = artifact.getFile();</span>
-<span class="fc" id="L146">            copiedArtifactAbsolutePath = new StringBuffer(workingDirectory.getAbsolutePath());</span>
-<span class="fc" id="L147">            copiedArtifactAbsolutePath.append(&quot;/&quot;);</span>
-<span class="fc" id="L148">            copiedArtifactAbsolutePath.append(artifactFile.getName());</span>
-<span class="fc" id="L149">            File copiedArtifact = new File(copiedArtifactAbsolutePath.toString());</span>
-<span class="fc" id="L150">            getLog().info(&quot;Copying: &quot; + artifactFile.getName());</span>
-<span class="fc" id="L151">            SharedFunctions.copyFile(getLog(), artifactFile, copiedArtifact);</span>
-<span class="fc" id="L152">        }</span>
-<span class="fc" id="L153">    }</span>
+<span class="fc" id="L245">        final String wdAbsolutePath = workingDirectory.getAbsolutePath();</span>
+<span class="fc" id="L246">        getLog().info(</span>
+<span class="fc" id="L247">                &quot;Copying &quot; + detachedArtifacts.size() + &quot; detached artifacts to working directory &quot; + wdAbsolutePath);</span>
+<span class="fc bfc" id="L248" title="All 2 branches covered.">        for (Artifact artifact: detachedArtifacts) {</span>
+<span class="fc" id="L249">            File artifactFile = artifact.getFile();</span>
+<span class="fc" id="L250">            copiedArtifactAbsolutePath = new StringBuffer(wdAbsolutePath);</span>
+<span class="fc" id="L251">            copiedArtifactAbsolutePath.append(&quot;/&quot;);</span>
+<span class="fc" id="L252">            copiedArtifactAbsolutePath.append(artifactFile.getName());</span>
+<span class="fc" id="L253">            File copiedArtifact = new File(copiedArtifactAbsolutePath.toString());</span>
+<span class="fc" id="L254">            getLog().info(&quot;Copying: &quot; + artifactFile.getName());</span>
+<span class="fc" id="L255">            SharedFunctions.copyFile(getLog(), artifactFile, copiedArtifact);</span>
+<span class="fc" id="L256">        }</span>
+<span class="fc" id="L257">    }</span>
 
     /**
-     *  A helper method that creates md5 and sha1 signature files for our detached artifacts in the
-     *  &lt;code&gt;target/commons-release-plugin&lt;/code&gt; directory for the purpose of being uploade by
+     *  A helper method that creates md5, sha1, and sha256  signature files for our detached artifacts in the
+     *  &lt;code&gt;target/commons-release-plugin&lt;/code&gt; directory for the purpose of being uploaded by
      *  the {@link CommonsDistributionStagingMojo}.
      *
      * @throws MojoExecutionException if some form of an {@link IOException} occurs, we want it
-     *                                properly wrapped so that maven can handle it.
+     *                                properly wrapped so that Maven can handle it.
      */
-    private void sha1AndMd5SignArtifacts() throws MojoExecutionException {
-<span class="fc bfc" id="L164" title="All 2 branches covered.">        for (Artifact artifact : detachedArtifacts) {</span>
-<span class="fc bfc" id="L165" title="All 2 branches covered.">            if (!artifact.getFile().getName().contains(&quot;asc&quot;)) {</span>
+    private void hashArtifacts() throws MojoExecutionException {
+<span class="fc bfc" id="L268" title="All 2 branches covered.">        for (Artifact artifact : detachedArtifacts) {</span>
+<span class="fc bfc" id="L269" title="All 2 branches covered.">            if (!artifact.getFile().getName().contains(&quot;asc&quot;)) {</span>
+<span class="fc" id="L270">                String artifactKey = getArtifactKey(artifact);</span>
                 try {
-<span class="fc" id="L167">                    String md5 = DigestUtils.md5Hex(Files.readAllBytes(artifact.getFile().toPath()));</span>
-<span class="fc" id="L168">                    getLog().info(artifact.getFile().getName() + &quot; md5: &quot; + md5);</span>
-<span class="fc" id="L169">                    PrintWriter md5Writer = new PrintWriter(getMd5FilePath(workingDirectory, artifact.getFile()));</span>
-<span class="fc" id="L170">                    md5Writer.println(md5);</span>
-<span class="fc" id="L171">                    String sha1 = DigestUtils.sha1Hex(Files.readAllBytes(artifact.getFile().toPath()));</span>
-<span class="fc" id="L172">                    getLog().info(artifact.getFile().getName() + &quot; sha1: &quot; + sha1);</span>
-<span class="fc" id="L173">                    PrintWriter sha1Writer = new PrintWriter(getSha1FilePath(workingDirectory, artifact.getFile()));</span>
-<span class="fc" id="L174">                    sha1Writer.println(sha1);</span>
-<span class="fc" id="L175">                    md5Writer.close();</span>
-<span class="fc" id="L176">                    sha1Writer.close();</span>
-<span class="nc" id="L177">                } catch (IOException e) {</span>
-<span class="nc" id="L178">                    throw new MojoExecutionException(&quot;Could not sign file: &quot; + artifact.getFile().getName(), e);</span>
-<span class="fc" id="L179">                }</span>
+                    String digest;
+                    // SHA-1
+<span class="fc" id="L274">                    digest = artifactSha1s.getProperty(artifactKey.toString());</span>
+<span class="fc" id="L275">                    getLog().info(artifact.getFile().getName() + &quot; sha1: &quot; + digest);</span>
+<span class="fc" id="L276">                    try (PrintWriter printWriter = new PrintWriter(</span>
+<span class="fc" id="L277">                            getSha1FilePath(workingDirectory, artifact.getFile()))) {</span>
+<span class="fc" id="L278">                        printWriter.println(digest);</span>
+                    }
+                    // SHA-256
+<span class="fc" id="L281">                    digest = artifactSha256s.getProperty(artifactKey.toString());</span>
+<span class="fc" id="L282">                    getLog().info(artifact.getFile().getName() + &quot; sha256: &quot; + digest);</span>
+<span class="fc" id="L283">                    try (PrintWriter printWriter = new PrintWriter(</span>
+<span class="fc" id="L284">                            getSha256FilePath(workingDirectory, artifact.getFile()))) {</span>
+<span class="fc" id="L285">                        printWriter.println(digest);</span>
+                    }
+<span class="nc" id="L287">                } catch (IOException e) {</span>
+<span class="nc" id="L288">                    throw new MojoExecutionException(&quot;Could not sign file: &quot; + artifact.getFile().getName(), e);</span>
+<span class="fc" id="L289">                }</span>
             }
-<span class="fc" id="L181">        }</span>
-<span class="fc" id="L182">    }</span>
+<span class="fc" id="L291">        }</span>
+<span class="fc" id="L292">    }</span>
 
     /**
      * A helper method to create a file path for the &lt;code&gt;md5&lt;/code&gt; signature file from a given file.
      *
-     * @param workingDirectory is the {@link File} for the directory in which to make the &lt;code&gt;.md5&lt;/code&gt; file.
+     * @param directory is the {@link File} for the directory in which to make the &lt;code&gt;.md5&lt;/code&gt; file.
      * @param file the {@link File} whose name we should use to create the &lt;code&gt;.md5&lt;/code&gt; file.
      * @return a {@link String} that is the absolute path to the &lt;code&gt;.md5&lt;/code&gt; file.
      */
-    private String getMd5FilePath(File workingDirectory, File file) {
-<span class="fc" id="L192">        StringBuffer buffer = new StringBuffer(workingDirectory.getAbsolutePath());</span>
-<span class="fc" id="L193">        buffer.append(&quot;/&quot;);</span>
-<span class="fc" id="L194">        buffer.append(file.getName());</span>
-<span class="fc" id="L195">        buffer.append(&quot;.md5&quot;);</span>
-<span class="fc" id="L196">        return buffer.toString();</span>
+    private String getMd5FilePath(File directory, File file) {
+<span class="nc" id="L302">        StringBuffer buffer = new StringBuffer(directory.getAbsolutePath());</span>
+<span class="nc" id="L303">        buffer.append(&quot;/&quot;);</span>
+<span class="nc" id="L304">        buffer.append(file.getName());</span>
+<span class="nc" id="L305">        buffer.append(&quot;.md5&quot;);</span>
+<span class="nc" id="L306">        return buffer.toString();</span>
     }
 
     /**
      * A helper method to create a file path for the &lt;code&gt;sha1&lt;/code&gt; signature file from a given file.
      *
-     * @param workingDirectory is the {@link File} for the directory in which to make the &lt;code&gt;.sha1&lt;/code&gt; file.
+     * @param directory is the {@link File} for the directory in which to make the &lt;code&gt;.sha1&lt;/code&gt; file.
      * @param file the {@link File} whose name we should use to create the &lt;code&gt;.sha1&lt;/code&gt; file.
      * @return a {@link String} that is the absolute path to the &lt;code&gt;.sha1&lt;/code&gt; file.
      */
-    private String getSha1FilePath(File workingDirectory, File file) {
-<span class="fc" id="L207">        StringBuffer buffer = new StringBuffer(workingDirectory.getAbsolutePath());</span>
-<span class="fc" id="L208">        buffer.append(&quot;/&quot;);</span>
-<span class="fc" id="L209">        buffer.append(file.getName());</span>
-<span class="fc" id="L210">        buffer.append(&quot;.sha1&quot;);</span>
-<span class="fc" id="L211">        return buffer.toString();</span>
+    private String getSha1FilePath(File directory, File file) {
+<span class="fc" id="L317">        StringBuffer buffer = new StringBuffer(directory.getAbsolutePath());</span>
+<span class="fc" id="L318">        buffer.append(&quot;/&quot;);</span>
+<span class="fc" id="L319">        buffer.append(file.getName());</span>
+<span class="fc" id="L320">        buffer.append(&quot;.sha1&quot;);</span>
+<span class="fc" id="L321">        return buffer.toString();</span>
+    }
+
+    /**
+     * A helper method to create a file path for the &lt;code&gt;sha1&lt;/code&gt; signature file from a given file.
+     *
+     * @param directory is the {@link File} for the directory in which to make the &lt;code&gt;.sha1&lt;/code&gt; file.
+     * @param file the {@link File} whose name we should use to create the &lt;code&gt;.sha1&lt;/code&gt; file.
+     * @return a {@link String} that is the absolute path to the &lt;code&gt;.sha1&lt;/code&gt; file.
+     */
+    private String getSha256FilePath(File directory, File file) {
+<span class="fc" id="L332">        StringBuffer buffer = new StringBuffer(directory.getAbsolutePath());</span>
+<span class="fc" id="L333">        buffer.append(&quot;/&quot;);</span>
+<span class="fc" id="L334">        buffer.append(file.getName());</span>
+<span class="fc" id="L335">        buffer.append(&quot;.sha256&quot;);</span>
+<span class="fc" id="L336">        return buffer.toString();</span>
+    }
+
+    /**
+     * Generates the unique artifact key for storage in our sha1 map and sha256 map. For example,
+     * commons-test-1.4-src.tar.gz should have it's name as the key.
+     *
+     * @param artifact the {@link Artifact} that we wish to generate a key for.
+     * @return the generated key
+     */
+    private String getArtifactKey(Artifact artifact) {
+<span class="fc" id="L347">        StringBuffer artifactKey = new StringBuffer();</span>
+<span class="fc" id="L348">        artifactKey.append(artifact.getArtifactId()).append('-')</span>
+<span class="fc" id="L349">                .append(artifact.getVersion()).append('-');</span>
+<span class="pc bpc" id="L350" title="1 of 2 branches missed.">        if (artifact.hasClassifier()) {</span>
+<span class="nc" id="L351">            artifactKey.append(artifact.getClassifier()).append('-');</span>
+        }
+<span class="fc" id="L353">        artifactKey.append(artifact.getType());</span>
+<span class="fc" id="L354">        return artifactKey.toString();</span>
     }
 }
 </pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.0.201801022044</span></div></body></html>
\ No newline at end of file

Modified: websites/production/commons/content/proper/commons-release-plugin/jacoco/org.apache.commons.release.plugin.mojos/CommonsDistributionStagingMojo.html
==============================================================================
--- websites/production/commons/content/proper/commons-release-plugin/jacoco/org.apache.commons.release.plugin.mojos/CommonsDistributionStagingMojo.html (original)
+++ websites/production/commons/content/proper/commons-release-plugin/jacoco/org.apache.commons.release.plugin.mojos/CommonsDistributionStagingMojo.html Tue Jun 19 03:50:24 2018
@@ -1 +1 @@
-<?xml version="1.0" encoding="iso-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>CommonsDistributionStagingMojo</title><script type="text/javascript" src="../jacoco-resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Commons Release Plugin</a> &gt; <a href="index.html" class="el_package">org.apache.commons.release.plugin.mojos</a> &gt; <span class="el_class">CommonsDistributionStagingMojo</span></div><h1>CommonsDistribution
 StagingMojo</h1><table class="coverage" cellspacing="0" id="coveragetable"><thead><tr><td class="sortable" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">214 of 504</td><td class="ctr2">57%</td><td class="bar">10 of
  22</td><td class="ctr2">54%</td><td class="ctr1">8</td><td class="ctr2">18</td><td class="ctr1">28</td><td class="ctr2">86</td><td class="ctr1">0</td><td class="ctr2">7</td></tr></tfoot><tbody><tr><td id="a5"><a href="CommonsDistributionStagingMojo.java.html#L131" class="el_method">execute()</a></td><td class="bar" id="b0"><img src="../jacoco-resources/redbar.gif" width="67" height="10" title="164" alt="164"/><img src="../jacoco-resources/greenbar.gif" width="52" height="10" title="128" alt="128"/></td><td class="ctr2" id="c6">43%</td><td class="bar" id="d0"><img src="../jacoco-resources/redbar.gif" width="68" height="10" title="8" alt="8"/><img src="../jacoco-resources/greenbar.gif" width="51" height="10" title="6" alt="6"/></td><td class="ctr2" id="e1">42%</td><td class="ctr1" id="f0">6</td><td class="ctr2" id="g0">8</td><td class="ctr1" id="h0">22</td><td class="ctr2" id="i0">47</td><td class="ctr1" id="j0">0</td><td class="ctr2" id="k0">1</td></tr><tr><td id="a3"><a href="Commo
 nsDistributionStagingMojo.java.html#L243" class="el_method">copyDistributionsIntoScmDirectoryStructure(File)</a></td><td class="bar" id="b1"><img src="../jacoco-resources/redbar.gif" width="20" height="10" title="50" alt="50"/><img src="../jacoco-resources/greenbar.gif" width="37" height="10" title="92" alt="92"/></td><td class="ctr2" id="c5">64%</td><td class="bar" id="d1"><img src="../jacoco-resources/redbar.gif" width="17" height="10" title="2" alt="2"/><img src="../jacoco-resources/greenbar.gif" width="51" height="10" title="6" alt="6"/></td><td class="ctr2" id="e0">75%</td><td class="ctr1" id="f1">2</td><td class="ctr2" id="g1">5</td><td class="ctr1" id="h1">6</td><td class="ctr2" id="i1">23</td><td class="ctr1" id="j1">0</td><td class="ctr2" id="k1">1</td></tr><tr><td id="a4"><a href="CommonsDistributionStagingMojo.java.html#L207" class="el_method">copyReleaseNotesToWorkingDirectory()</a></td><td class="bar" id="b2"><img src="../jacoco-resources/greenbar.gif" width="14" height
 ="10" title="35" alt="35"/></td><td class="ctr2" id="c0">100%</td><td class="bar" id="d2"/><td class="ctr2" id="e2">n/a</td><td class="ctr1" id="f2">0</td><td class="ctr2" id="g2">1</td><td class="ctr1" id="h2">0</td><td class="ctr2" id="i2">7</td><td class="ctr1" id="j2">0</td><td class="ctr2" id="k2">1</td></tr><tr><td id="a0"><a href="CommonsDistributionStagingMojo.java.html#L279" class="el_method">buildDistBinariesRoot()</a></td><td class="bar" id="b3"><img src="../jacoco-resources/greenbar.gif" width="5" height="10" title="14" alt="14"/></td><td class="ctr2" id="c1">100%</td><td class="bar" id="d3"/><td class="ctr2" id="e3">n/a</td><td class="ctr1" id="f3">0</td><td class="ctr2" id="g3">1</td><td class="ctr1" id="h3">0</td><td class="ctr2" id="i3">3</td><td class="ctr1" id="j3">0</td><td class="ctr2" id="k3">1</td></tr><tr><td id="a1"><a href="CommonsDistributionStagingMojo.java.html#L291" class="el_method">buildDistSourceRoot()</a></td><td class="bar" id="b4"><img src="../jaco
 co-resources/greenbar.gif" width="5" height="10" title="14" alt="14"/></td><td class="ctr2" id="c2">100%</td><td class="bar" id="d4"/><td class="ctr2" id="e4">n/a</td><td class="ctr1" id="f4">0</td><td class="ctr2" id="g4">1</td><td class="ctr1" id="h4">0</td><td class="ctr2" id="i4">3</td><td class="ctr1" id="j4">0</td><td class="ctr2" id="k4">1</td></tr><tr><td id="a6"><a href="CommonsDistributionStagingMojo.java.html#L304" class="el_method">setBasedir(File)</a></td><td class="bar" id="b5"><img src="../jacoco-resources/greenbar.gif" width="1" height="10" title="4" alt="4"/></td><td class="ctr2" id="c3">100%</td><td class="bar" id="d5"/><td class="ctr2" id="e5">n/a</td><td class="ctr1" id="f5">0</td><td class="ctr2" id="g5">1</td><td class="ctr1" id="h5">0</td><td class="ctr2" id="i5">2</td><td class="ctr1" id="j5">0</td><td class="ctr2" id="k5">1</td></tr><tr><td id="a2"><a href="CommonsDistributionStagingMojo.java.html#L57" class="el_method">CommonsDistributionStagingMojo()</a></
 td><td class="bar" id="b6"><img src="../jacoco-resources/greenbar.gif" width="1" height="10" title="3" alt="3"/></td><td class="ctr2" id="c4">100%</td><td class="bar" id="d6"/><td class="ctr2" id="e6">n/a</td><td class="ctr1" id="f6">0</td><td class="ctr2" id="g6">1</td><td class="ctr1" id="h6">0</td><td class="ctr2" id="i6">1</td><td class="ctr1" id="j6">0</td><td class="ctr2" id="k6">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.0.201801022044</span></div></body></html>
\ No newline at end of file
+<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>CommonsDistributionStagingMojo</title><script type="text/javascript" src="../jacoco-resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Commons Release Plugin</a> &gt; <a href="index.html" class="el_package">org.apache.commons.release.plugin.mojos</a> &gt; <span class="el_class">CommonsDistributionStagingMojo</span></div><h1>CommonsDistribution
 StagingMojo</h1><table class="coverage" cellspacing="0" id="coveragetable"><thead><tr><td class="sortable" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">215 of 760</td><td class="ctr2">71%</td><td class="bar">13 of
  34</td><td class="ctr2">61%</td><td class="ctr1">11</td><td class="ctr2">26</td><td class="ctr1">35</td><td class="ctr2">140</td><td class="ctr1">0</td><td class="ctr2">9</td></tr></tfoot><tbody><tr><td id="a6"><a href="CommonsDistributionStagingMojo.java.html#L165" class="el_method">execute()</a></td><td class="bar" id="b0"><img src="../jacoco-resources/redbar.gif" width="56" height="10" title="139" alt="139"/><img src="../jacoco-resources/greenbar.gif" width="63" height="10" title="158" alt="158"/></td><td class="ctr2" id="c8">53%</td><td class="bar" id="d0"><img src="../jacoco-resources/redbar.gif" width="68" height="10" title="8" alt="8"/><img src="../jacoco-resources/greenbar.gif" width="51" height="10" title="6" alt="6"/></td><td class="ctr2" id="e3">42%</td><td class="ctr1" id="f0">6</td><td class="ctr2" id="g0">8</td><td class="ctr1" id="h0">20</td><td class="ctr2" id="i0">49</td><td class="ctr1" id="j0">0</td><td class="ctr2" id="k0">1</td></tr><tr><td id="a0"><a href="Com
 monsDistributionStagingMojo.java.html#L377" class="el_method">buildReadmeAndHeaderHtmlFiles()</a></td><td class="bar" id="b1"><img src="../jacoco-resources/redbar.gif" width="16" height="10" title="42" alt="42"/><img src="../jacoco-resources/greenbar.gif" width="33" height="10" title="83" alt="83"/></td><td class="ctr2" id="c6">66%</td><td class="bar" id="d4"/><td class="ctr2" id="e4">n/a</td><td class="ctr1" id="f4">0</td><td class="ctr2" id="g4">1</td><td class="ctr1" id="h1">8</td><td class="ctr2" id="i1">26</td><td class="ctr1" id="j1">0</td><td class="ctr2" id="k1">1</td></tr><tr><td id="a2"><a href="CommonsDistributionStagingMojo.java.html#L305" class="el_method">copyDistributionsIntoScmDirectoryStructureAndAddToSvn(File, ScmProvider, ScmRepository)</a></td><td class="bar" id="b2"><img src="../jacoco-resources/redbar.gif" width="7" height="10" title="18" alt="18"/><img src="../jacoco-resources/greenbar.gif" width="48" height="10" title="121" alt="121"/></td><td class="ctr2" id
 ="c5">87%</td><td class="bar" id="d2"><img src="../jacoco-resources/redbar.gif" width="8" height="10" title="1" alt="1"/><img src="../jacoco-resources/greenbar.gif" width="60" height="10" title="7" alt="7"/></td><td class="ctr2" id="e0">87%</td><td class="ctr1" id="f2">1</td><td class="ctr2" id="g2">5</td><td class="ctr1" id="h3">3</td><td class="ctr2" id="i2">24</td><td class="ctr1" id="j2">0</td><td class="ctr2" id="k2">1</td></tr><tr><td id="a5"><a href="CommonsDistributionStagingMojo.java.html#L343" class="el_method">copySiteToScmDirectory()</a></td><td class="bar" id="b3"><img src="../jacoco-resources/redbar.gif" width="6" height="10" title="16" alt="16"/><img src="../jacoco-resources/greenbar.gif" width="10" height="10" title="25" alt="25"/></td><td class="ctr2" id="c7">60%</td><td class="bar" id="d3"><img src="../jacoco-resources/redbar.gif" width="8" height="10" title="1" alt="1"/><img src="../jacoco-resources/greenbar.gif" width="8" height="10" title="1" alt="1"/></td><td c
 lass="ctr2" id="e2">50%</td><td class="ctr1" id="f3">1</td><td class="ctr2" id="g3">2</td><td class="ctr1" id="h2">4</td><td class="ctr2" id="i4">9</td><td class="ctr1" id="j3">0</td><td class="ctr2" id="k3">1</td></tr><tr><td id="a3"><a href="CommonsDistributionStagingMojo.java.html#L425" class="el_method">copyHeaderAndReadmeToSubdirectories(File, File)</a></td><td class="bar" id="b4"><img src="../jacoco-resources/greenbar.gif" width="32" height="10" title="80" alt="80"/></td><td class="ctr2" id="c0">100%</td><td class="bar" id="d5"/><td class="ctr2" id="e5">n/a</td><td class="ctr1" id="f5">0</td><td class="ctr2" id="g5">1</td><td class="ctr1" id="h4">0</td><td class="ctr2" id="i3">16</td><td class="ctr1" id="j4">0</td><td class="ctr2" id="k4">1</td></tr><tr><td id="a7"><a href="CommonsDistributionStagingMojo.java.html#L240" class="el_method">listNotHiddenFilesAndDirectories(File, List)</a></td><td class="bar" id="b5"><img src="../jacoco-resources/greenbar.gif" width="18" height="1
 0" title="45" alt="45"/></td><td class="ctr2" id="c1">100%</td><td class="bar" id="d1"><img src="../jacoco-resources/redbar.gif" width="25" height="10" title="3" alt="3"/><img src="../jacoco-resources/greenbar.gif" width="60" height="10" title="7" alt="7"/></td><td class="ctr2" id="e1">70%</td><td class="ctr1" id="f1">3</td><td class="ctr2" id="g1">6</td><td class="ctr1" id="h5">0</td><td class="ctr2" id="i5">8</td><td class="ctr1" id="j5">0</td><td class="ctr2" id="k5">1</td></tr><tr><td id="a4"><a href="CommonsDistributionStagingMojo.java.html#L263" class="el_method">copyReleaseNotesToWorkingDirectory()</a></td><td class="bar" id="b6"><img src="../jacoco-resources/greenbar.gif" width="10" height="10" title="26" alt="26"/></td><td class="ctr2" id="c2">100%</td><td class="bar" id="d6"/><td class="ctr2" id="e6">n/a</td><td class="ctr1" id="f6">0</td><td class="ctr2" id="g6">1</td><td class="ctr1" id="h6">0</td><td class="ctr2" id="i6">5</td><td class="ctr1" id="j6">0</td><td class="c
 tr2" id="k6">1</td></tr><tr><td id="a8"><a href="CommonsDistributionStagingMojo.java.html#L451" class="el_method">setBaseDir(File)</a></td><td class="bar" id="b7"><img src="../jacoco-resources/greenbar.gif" width="1" height="10" title="4" alt="4"/></td><td class="ctr2" id="c3">100%</td><td class="bar" id="d7"/><td class="ctr2" id="e7">n/a</td><td class="ctr1" id="f7">0</td><td class="ctr2" id="g7">1</td><td class="ctr1" id="h7">0</td><td class="ctr2" id="i7">2</td><td class="ctr1" id="j7">0</td><td class="ctr2" id="k7">1</td></tr><tr><td id="a1"><a href="CommonsDistributionStagingMojo.java.html#L64" class="el_method">CommonsDistributionStagingMojo()</a></td><td class="bar" id="b8"><img src="../jacoco-resources/greenbar.gif" width="1" height="10" title="3" alt="3"/></td><td class="ctr2" id="c4">100%</td><td class="bar" id="d8"/><td class="ctr2" id="e8">n/a</td><td class="ctr1" id="f8">0</td><td class="ctr2" id="g8">1</td><td class="ctr1" id="h8">0</td><td class="ctr2" id="i8">1</td><
 td class="ctr1" id="j8">0</td><td class="ctr2" id="k8">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.0.201801022044</span></div></body></html>
\ No newline at end of file

Modified: websites/production/commons/content/proper/commons-release-plugin/jacoco/org.apache.commons.release.plugin.mojos/CommonsDistributionStagingMojo.java.html
==============================================================================
--- websites/production/commons/content/proper/commons-release-plugin/jacoco/org.apache.commons.release.plugin.mojos/CommonsDistributionStagingMojo.java.html (original)
+++ websites/production/commons/content/proper/commons-release-plugin/jacoco/org.apache.commons.release.plugin.mojos/CommonsDistributionStagingMojo.java.html Tue Jun 19 03:50:24 2018
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="iso-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>CommonsDistributionStagingMojo.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Commons Release Plugin</a> &gt; <a href="index.source.html" class="el_package">org.apache.commons.release.plug
 in.mojos</a> &gt; <span class="el_source">CommonsDistributionStagingMojo.java</span></div><h1>CommonsDistributionStagingMojo.java</h1><pre class="source lang-java linenums">/*
+<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>CommonsDistributionStagingMojo.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Commons Release Plugin</a> &gt; <a href="index.source.html" class="el_package">org.apache.commons.release.plug
 in.mojos</a> &gt; <span class="el_source">CommonsDistributionStagingMojo.java</span></div><h1>CommonsDistributionStagingMojo.java</h1><pre class="source lang-java linenums">/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -16,11 +16,15 @@
  */
 package org.apache.commons.release.plugin.mojos;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.release.plugin.SharedFunctions;
+import org.apache.commons.release.plugin.velocity.HeaderHtmlVelocityDelegate;
+import org.apache.commons.release.plugin.velocity.ReadmeHtmlVelocityDelegate;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.plugins.annotations.LifecyclePhase;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
@@ -37,7 +41,10 @@ import org.apache.maven.scm.provider.svn
 import org.apache.maven.scm.repository.ScmRepository;
 
 import java.io.File;
+import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -54,7 +61,12 @@ import java.util.List;
         defaultPhase = LifecyclePhase.DEPLOY,
         threadSafe = true,
         aggregator = true)
-<span class="fc" id="L57">public class CommonsDistributionStagingMojo extends AbstractMojo {</span>
+<span class="fc" id="L64">public class CommonsDistributionStagingMojo extends AbstractMojo {</span>
+
+    /** The name of file generated from the README.vm velocity template to be checked into the dist svn repo. */
+    private static final String README_FILE_NAME = &quot;README.html&quot;;
+    /** The name of file generated from the HEADER.vm velocity template to be checked into the dist svn repo. */
+    private static final String HEADER_FILE_NAME = &quot;HEADER.html&quot;;
 
     /**
      * The {@link MavenProject} object is essentially the context of the maven build at
@@ -68,7 +80,11 @@ import java.util.List;
      * this directory is where the &lt;code&gt;pom.xml&lt;/code&gt; resides.
      */
     @Parameter(defaultValue = &quot;${basedir}&quot;)
-    private File basedir;
+    private File baseDir;
+
+    /** The location to which the site gets built during running &lt;code&gt;mvn site&lt;/code&gt;. */
+    @Parameter(defaultValue = &quot;${project.build.directory}/site&quot;, property = &quot;commons.siteOutputDirectory&quot;)
+    private File siteDirectory;
 
     /**
      * The main working directory for the plugin, namely &lt;code&gt;target/commons-release-plugin&lt;/code&gt;, but
@@ -86,7 +102,7 @@ import java.util.List;
     private File distCheckoutDirectory;
 
     /**
-     * The location of the RELEASE-NOTES.txt file such that multimodule builds can configure it.
+     * The location of the RELEASE-NOTES.txt file such that multi-module builds can configure it.
      */
     @Parameter(defaultValue = &quot;${basedir}/RELEASE-NOTES.txt&quot;, property = &quot;commons.releaseNotesLocation&quot;)
     private File releaseNotesFile;
@@ -100,10 +116,9 @@ import java.util.List;
     private Boolean dryRun;
 
     /**
-     * The url of the subversion repository to which we wish the artifacts to be staged. Typicallly
-     * this would need to be of the form:
-     * &lt;code&gt;scm:svn:https://dist.apache.org/repos/dist/dev/commons/foo&lt;/code&gt;. Note. that the prefix to the
-     * substring &lt;code&gt;https&lt;/code&gt; is a requirement.
+     * The url of the subversion repository to which we wish the artifacts to be staged. Typically this would need to
+     * be of the form: &lt;code&gt;scm:svn:https://dist.apache.org/repos/dist/dev/commons/foo/version-RC#&lt;/code&gt;. Note. that
+     * the prefix to the substring &lt;code&gt;https&lt;/code&gt; is a requirement.
      */
     @Parameter(defaultValue = &quot;&quot;, property = &quot;commons.distSvnStagingUrl&quot;)
     private String distSvnStagingUrl;
@@ -115,7 +130,19 @@ import java.util.List;
     private Boolean isDistModule;
 
     /**
-     * The username for the distribution subversion repository. This is typically your apache id.
+     * The release version of the artifact to be built.
+     */
+    @Parameter(property = &quot;commons.release.version&quot;)
+    private String commonsReleaseVersion;
+
+    /**
+     * The RC version of the release. For example the first voted on candidate would be &quot;RC1&quot;.
+     */
+    @Parameter(property = &quot;commons.rc.version&quot;)
+    private String commonsRcVersion;
+
+    /**
+     * The username for the distribution subversion repository. This is typically your Apache id.
      */
     @Parameter(property = &quot;user.name&quot;)
     private String username;
@@ -126,71 +153,100 @@ import java.util.List;
     @Parameter(property = &quot;user.password&quot;)
     private String password;
 
+    /**
+     * A subdirectory of the dist directory into which we are going to stage the release candidate. We
+     * build this up in the {@link CommonsDistributionStagingMojo#execute()} method. And, for example,
+     * the directory should look like &lt;code&gt;https://https://dist.apache.org/repos/dist/dev/commons/text/1.4-RC1&lt;/code&gt;.
+     */
+    private File distVersionRcVersionDirectory;
+
     @Override
     public void execute() throws MojoExecutionException, MojoFailureException {
-<span class="fc bfc" id="L131" title="All 2 branches covered.">        if (!isDistModule) {</span>
-<span class="fc" id="L132">            getLog().info(&quot;This module is marked as a non distribution &quot;</span>
+<span class="fc bfc" id="L165" title="All 2 branches covered.">        if (!isDistModule) {</span>
+<span class="fc" id="L166">            getLog().info(&quot;This module is marked as a non distribution &quot;</span>
                     + &quot;or assembly module, and the plugin will not run.&quot;);
-<span class="fc" id="L134">            return;</span>
+<span class="fc" id="L168">            return;</span>
         }
-<span class="pc bpc" id="L136" title="1 of 2 branches missed.">        if (StringUtils.isEmpty(distSvnStagingUrl)) {</span>
-<span class="nc" id="L137">            getLog().warn(&quot;commons.distSvnStagingUrl is not set, the commons-release-plugin will not run.&quot;);</span>
-<span class="nc" id="L138">            return;</span>
+<span class="pc bpc" id="L170" title="1 of 2 branches missed.">        if (StringUtils.isEmpty(distSvnStagingUrl)) {</span>
+<span class="nc" id="L171">            getLog().warn(&quot;commons.distSvnStagingUrl is not set, the commons-release-plugin will not run.&quot;);</span>
+<span class="nc" id="L172">            return;</span>
         }
-<span class="pc bpc" id="L140" title="1 of 2 branches missed.">        if (!workingDirectory.exists()) {</span>
-<span class="nc" id="L141">            getLog().info(&quot;Current project contains no distributions. Not executing.&quot;);</span>
-<span class="nc" id="L142">            return;</span>
+<span class="pc bpc" id="L174" title="1 of 2 branches missed.">        if (!workingDirectory.exists()) {</span>
+<span class="nc" id="L175">            getLog().info(&quot;Current project contains no distributions. Not executing.&quot;);</span>
+<span class="nc" id="L176">            return;</span>
         }
-<span class="fc" id="L144">        getLog().info(&quot;Preparing to stage distributions&quot;);</span>
+<span class="fc" id="L178">        getLog().info(&quot;Preparing to stage distributions&quot;);</span>
         try {
-<span class="fc" id="L146">            ScmManager scmManager = new BasicScmManager();</span>
-<span class="fc" id="L147">            scmManager.setScmProvider(&quot;svn&quot;, new SvnExeScmProvider());</span>
-<span class="fc" id="L148">            ScmRepository repository = scmManager.makeScmRepository(distSvnStagingUrl);</span>
-<span class="fc" id="L149">            ScmProvider provider = scmManager.getProviderByRepository(repository);</span>
-<span class="fc" id="L150">            SvnScmProviderRepository providerRepository = (SvnScmProviderRepository) repository.getProviderRepository();</span>
-<span class="fc" id="L151">            providerRepository.setUser(username);</span>
-<span class="fc" id="L152">            providerRepository.setPassword(password);</span>
-<span class="pc bpc" id="L153" title="1 of 2 branches missed.">            if (!distCheckoutDirectory.exists()) {</span>
-<span class="fc" id="L154">                SharedFunctions.initDirectory(getLog(), distCheckoutDirectory);</span>
+<span class="fc" id="L180">            ScmManager scmManager = new BasicScmManager();</span>
+<span class="fc" id="L181">            scmManager.setScmProvider(&quot;svn&quot;, new SvnExeScmProvider());</span>
+<span class="fc" id="L182">            ScmRepository repository = scmManager.makeScmRepository(distSvnStagingUrl);</span>
+<span class="fc" id="L183">            ScmProvider provider = scmManager.getProviderByRepository(repository);</span>
+<span class="fc" id="L184">            SvnScmProviderRepository providerRepository = (SvnScmProviderRepository) repository.getProviderRepository();</span>
+<span class="fc" id="L185">            providerRepository.setUser(username);</span>
+<span class="fc" id="L186">            providerRepository.setPassword(password);</span>
+<span class="fc" id="L187">            distVersionRcVersionDirectory =</span>
+                    new File(distCheckoutDirectory, commonsReleaseVersion + &quot;-&quot; + commonsRcVersion);
+<span class="pc bpc" id="L189" title="1 of 2 branches missed.">            if (!distCheckoutDirectory.exists()) {</span>
+<span class="fc" id="L190">                SharedFunctions.initDirectory(getLog(), distCheckoutDirectory);</span>
             }
-<span class="fc" id="L156">            ScmFileSet scmFileSet = new ScmFileSet(distCheckoutDirectory);</span>
-<span class="fc" id="L157">            getLog().info(&quot;Checking out dist from: &quot; + distSvnStagingUrl);</span>
-<span class="fc" id="L158">            provider.checkOut(repository, scmFileSet);</span>
-<span class="fc" id="L159">            File copiedReleaseNotes = copyReleaseNotesToWorkingDirectory();</span>
-<span class="fc" id="L160">            List&lt;File&gt; filesToCommit = copyDistributionsIntoScmDirectoryStructure(copiedReleaseNotes);</span>
-<span class="pc bpc" id="L161" title="1 of 2 branches missed.">            if (!dryRun) {</span>
-<span class="nc" id="L162">                ScmFileSet scmFileSetToCommit = new ScmFileSet(distCheckoutDirectory, filesToCommit);</span>
-<span class="nc" id="L163">                AddScmResult addResult = provider.add(</span>
+<span class="fc" id="L192">            ScmFileSet scmFileSet = new ScmFileSet(distCheckoutDirectory);</span>
+<span class="fc" id="L193">            getLog().info(&quot;Checking out dist from: &quot; + distSvnStagingUrl);</span>
+<span class="fc" id="L194">            provider.checkOut(repository, scmFileSet);</span>
+<span class="fc" id="L195">            File copiedReleaseNotes = copyReleaseNotesToWorkingDirectory();</span>
+<span class="fc" id="L196">            copyDistributionsIntoScmDirectoryStructureAndAddToSvn(copiedReleaseNotes,</span>
+                    provider, repository);
+<span class="fc" id="L198">            List&lt;File&gt; filesToAdd = new ArrayList&lt;&gt;();</span>
+<span class="fc" id="L199">            listNotHiddenFilesAndDirectories(distCheckoutDirectory, filesToAdd);</span>
+<span class="pc bpc" id="L200" title="1 of 2 branches missed.">            if (!dryRun) {</span>
+<span class="nc" id="L201">                ScmFileSet fileSet = new ScmFileSet(distCheckoutDirectory, filesToAdd);</span>
+<span class="nc" id="L202">                AddScmResult addResult = provider.add(</span>
                         repository,
-                        scmFileSetToCommit,
-<span class="nc" id="L166">                        &quot;Staging release: &quot; + project.getArtifactId() + &quot;, version: &quot; + project.getVersion()</span>
+                        fileSet
                 );
-<span class="nc bnc" id="L168" title="All 2 branches missed.">                if (addResult.isSuccess()) {</span>
-<span class="nc" id="L169">                    getLog().info(&quot;Staging release: &quot; + project.getArtifactId() + &quot;, version: &quot; + project.getVersion());</span>
-<span class="nc" id="L170">                    CheckInScmResult checkInResult = provider.checkIn(</span>
-                            repository,
-                            scmFileSetToCommit,
-<span class="nc" id="L173">                            &quot;Staging release: &quot; + project.getArtifactId() + &quot;, version: &quot; + project.getVersion()</span>
+<span class="nc bnc" id="L206" title="All 2 branches missed.">                if (!addResult.isSuccess()) {</span>
+<span class="nc" id="L207">                    throw new MojoExecutionException(&quot;Failed to add files to scm&quot;);</span>
+                }
+<span class="nc" id="L209">                getLog().info(&quot;Staging release: &quot; + project.getArtifactId() + &quot;, version: &quot; + project.getVersion());</span>
+<span class="nc" id="L210">                CheckInScmResult checkInResult = provider.checkIn(</span>
+                        repository,
+                        fileSet,
+<span class="nc" id="L213">                        &quot;Staging release: &quot; + project.getArtifactId() + &quot;, version: &quot; + project.getVersion()</span>
+                );
+<span class="nc bnc" id="L215" title="All 2 branches missed.">                if (!checkInResult.isSuccess()) {</span>
+<span class="nc" id="L216">                    getLog().error(&quot;Committing dist files failed: &quot; + checkInResult.getCommandOutput());</span>
+<span class="nc" id="L217">                    throw new MojoExecutionException(</span>
+<span class="nc" id="L218">                            &quot;Committing dist files failed: &quot; + checkInResult.getCommandOutput()</span>
                     );
-<span class="nc bnc" id="L175" title="All 2 branches missed.">                    if (!checkInResult.isSuccess()) {</span>
-<span class="nc" id="L176">                        getLog().error(&quot;Committing dist files failed: &quot; + checkInResult.getCommandOutput());</span>
-<span class="nc" id="L177">                        throw new MojoExecutionException(</span>
-<span class="nc" id="L178">                                &quot;Committing dist files failed: &quot; + checkInResult.getCommandOutput()</span>
-                        );
-                    }
-<span class="nc" id="L181">                } else {</span>
-<span class="nc" id="L182">                    getLog().error(&quot;Adding dist files failed: &quot; + addResult.getCommandOutput());</span>
-<span class="nc" id="L183">                    throw new MojoExecutionException(&quot;Adding dist files failed: &quot; + addResult.getCommandOutput());</span>
                 }
-<span class="nc" id="L185">            } else {</span>
-<span class="fc" id="L186">                getLog().info(&quot;Would have committed to: &quot; + distSvnStagingUrl);</span>
-<span class="fc" id="L187">                getLog().info(&quot;Staging release: &quot; + project.getArtifactId() + &quot;, version: &quot; + project.getVersion());</span>
+<span class="nc" id="L221">                getLog().info(&quot;Committed revision &quot; + checkInResult.getScmRevision());</span>
+<span class="nc" id="L222">            } else {</span>
+<span class="fc" id="L223">                getLog().info(&quot;[Dry run] Would have committed to: &quot; + distSvnStagingUrl);</span>
+<span class="fc" id="L224">                getLog().info(</span>
+<span class="fc" id="L225">                        &quot;[Dry run] Staging release: &quot; + project.getArtifactId() + &quot;, version: &quot; + project.getVersion());</span>
+            }
+<span class="nc" id="L227">        } catch (ScmException e) {</span>
+<span class="nc" id="L228">            getLog().error(&quot;Could not commit files to dist: &quot; + distSvnStagingUrl, e);</span>
+<span class="nc" id="L229">            throw new MojoExecutionException(&quot;Could not commit files to dist: &quot; + distSvnStagingUrl, e);</span>
+<span class="fc" id="L230">        }</span>
+<span class="fc" id="L231">    }</span>
+
+    /**
+     * Lists all directories and files to a flat list.
+     * @param directory {@link File} containing directory to list
+     * @param files a {@link List} of {@link File} to which to append the files.
+     */
+    private void listNotHiddenFilesAndDirectories(File directory, List&lt;File&gt; files) {
+        // Get all the files and directories from a directory.
+<span class="fc" id="L240">        File[] fList = directory.listFiles();</span>
+<span class="fc bfc" id="L241" title="All 2 branches covered.">        for (File file : fList) {</span>
+<span class="pc bpc" id="L242" title="1 of 4 branches missed.">            if (file.isFile() &amp;&amp; !file.isHidden()) {</span>
+<span class="fc" id="L243">                files.add(file);</span>
+<span class="pc bpc" id="L244" title="2 of 4 branches missed.">            } else if (file.isDirectory() &amp;&amp; !file.isHidden()) {</span>
+<span class="fc" id="L245">                files.add(file);</span>
+<span class="fc" id="L246">                listNotHiddenFilesAndDirectories(file, files);</span>
             }
-<span class="nc" id="L189">        } catch (ScmException e) {</span>
-<span class="nc" id="L190">            getLog().error(&quot;Could not commit files to dist: &quot; + distSvnStagingUrl, e);</span>
-<span class="nc" id="L191">            throw new MojoExecutionException(&quot;Could not commit files to dist: &quot; + distSvnStagingUrl, e);</span>
-<span class="fc" id="L192">        }</span>
-<span class="fc" id="L193">    }</span>
+        }
+<span class="fc" id="L249">    }</span>
 
     /**
      * A utility method that takes the &lt;code&gt;RELEASE-NOTES.txt&lt;/code&gt; file from the base directory of the
@@ -198,110 +254,201 @@ import java.util.List;
      *
      * @return the RELEASE-NOTES.txt file that exists in the &lt;code&gt;target/commons-release-notes/scm&lt;/code&gt;
      *         directory for the purpose of adding it to the scm change set in the method
-     *         {@link CommonsDistributionStagingMojo#copyDistributionsIntoScmDirectoryStructure(File)}.
-     * @throws MojoExecutionException if an {@link IOException} occurrs as a wrapper so that maven
+     *         {@link CommonsDistributionStagingMojo#copyDistributionsIntoScmDirectoryStructureAndAddToSvn(File,
+     *         ScmProvider, ScmRepository)}.
+     * @throws MojoExecutionException if an {@link IOException} occurs as a wrapper so that maven
      *                                can properly handle the exception.
      */
     private File copyReleaseNotesToWorkingDirectory() throws MojoExecutionException {
-        StringBuffer copiedReleaseNotesAbsolutePath;
-<span class="fc" id="L207">        getLog().info(&quot;Copying RELEASE-NOTES.txt to working directory.&quot;);</span>
-<span class="fc" id="L208">        copiedReleaseNotesAbsolutePath = new StringBuffer(workingDirectory.getAbsolutePath());</span>
-<span class="fc" id="L209">        copiedReleaseNotesAbsolutePath.append(&quot;/scm/&quot;);</span>
-<span class="fc" id="L210">        copiedReleaseNotesAbsolutePath.append(releaseNotesFile.getName());</span>
-<span class="fc" id="L211">        File copiedReleaseNotes = new File(copiedReleaseNotesAbsolutePath.toString());</span>
-<span class="fc" id="L212">        SharedFunctions.copyFile(getLog(), releaseNotesFile, copiedReleaseNotes);</span>
-<span class="fc" id="L213">        return copiedReleaseNotes;</span>
+<span class="fc" id="L263">        SharedFunctions.initDirectory(getLog(), distVersionRcVersionDirectory);</span>
+<span class="fc" id="L264">        getLog().info(&quot;Copying RELEASE-NOTES.txt to working directory.&quot;);</span>
+<span class="fc" id="L265">        File copiedReleaseNotes = new File(distVersionRcVersionDirectory, releaseNotesFile.getName());</span>
+<span class="fc" id="L266">        SharedFunctions.copyFile(getLog(), releaseNotesFile, copiedReleaseNotes);</span>
+<span class="fc" id="L267">        return copiedReleaseNotes;</span>
     }
 
     /**
      * Copies the list of files at the root of the {@link CommonsDistributionStagingMojo#workingDirectory} into
      * the directory structure of the distribution staging repository. Specifically:
      * &lt;ul&gt;
-     *     &lt;li&gt;root:&lt;/li&gt;
-     *     &lt;li&gt;&lt;ul&gt;
+     *   &lt;li&gt;root:
+     *     &lt;ul&gt;
+     *         &lt;li&gt;site&lt;/li&gt;
      *         &lt;li&gt;site.zip&lt;/li&gt;
      *         &lt;li&gt;RELEASE-NOTES.txt&lt;/li&gt;
-     *         &lt;li&gt;source:&lt;/li&gt;
-     *         &lt;li&gt;&lt;ul&gt;
+     *         &lt;li&gt;source:
+     *           &lt;ul&gt;
      *             &lt;li&gt;-src artifacts....&lt;/li&gt;
-     *         &lt;/ul&gt;&lt;/li&gt;
-     *         &lt;li&gt;binaries:&lt;/li&gt;
-     *         &lt;li&gt;&lt;ul&gt;
+     *           &lt;/ul&gt;
+     *         &lt;/li&gt;
+     *         &lt;li&gt;binaries:
+     *           &lt;ul&gt;
      *             &lt;li&gt;-bin artifacts....&lt;/li&gt;
-     *         &lt;/ul&gt;&lt;/li&gt;
-     *     &lt;/ul&gt;&lt;/li&gt;
+     *           &lt;/ul&gt;
+     *         &lt;/li&gt;
+     *     &lt;/ul&gt;
+     *   &lt;/li&gt;
      * &lt;/ul&gt;
      *
      * @param copiedReleaseNotes is the RELEASE-NOTES.txt file that exists in the
      *                           &lt;code&gt;target/commons-release-plugin/scm&lt;/code&gt; directory.
+     * @param provider is the {@link ScmProvider} that we will use for adding the files we wish to commit.
+     * @param repository is the {@link ScmRepository} that we will use for adding the files that we wish to commit.
      * @return a {@link List} of {@link File}'s in the directory for the purpose of adding them to the maven
      *         {@link ScmFileSet}.
-     * @throws MojoExecutionException if an {@link IOException} occurrs so that Maven can handle it properly.
+     * @throws MojoExecutionException if an {@link IOException} occurs so that Maven can handle it properly.
      */
-    private List&lt;File&gt; copyDistributionsIntoScmDirectoryStructure(File copiedReleaseNotes)
+    private List&lt;File&gt; copyDistributionsIntoScmDirectoryStructureAndAddToSvn(File copiedReleaseNotes,
+                                                                             ScmProvider provider,
+                                                                             ScmRepository repository)
             throws MojoExecutionException {
-<span class="fc" id="L243">        List&lt;File&gt; workingDirectoryFiles = Arrays.asList(workingDirectory.listFiles());</span>
-<span class="fc" id="L244">        String scmBinariesRoot = buildDistBinariesRoot();</span>
-<span class="fc" id="L245">        String scmSourceRoot = buildDistSourceRoot();</span>
-<span class="fc" id="L246">        SharedFunctions.initDirectory(getLog(), new File(scmBinariesRoot));</span>
-<span class="fc" id="L247">        SharedFunctions.initDirectory(getLog(), new File(scmSourceRoot));</span>
-<span class="fc" id="L248">        List&lt;File&gt; filesForMavenScmFileSet = new ArrayList&lt;&gt;();</span>
+<span class="fc" id="L305">        List&lt;File&gt; workingDirectoryFiles = Arrays.asList(workingDirectory.listFiles());</span>
+<span class="fc" id="L306">        List&lt;File&gt; filesForMavenScmFileSet = new ArrayList&lt;&gt;();</span>
+<span class="fc" id="L307">        File scmBinariesRoot = new File(distVersionRcVersionDirectory, &quot;binaries&quot;);</span>
+<span class="fc" id="L308">        File scmSourceRoot = new File(distVersionRcVersionDirectory, &quot;source&quot;);</span>
+<span class="fc" id="L309">        SharedFunctions.initDirectory(getLog(), scmBinariesRoot);</span>
+<span class="fc" id="L310">        SharedFunctions.initDirectory(getLog(), scmSourceRoot);</span>
         File copy;
-<span class="fc bfc" id="L250" title="All 2 branches covered.">        for (File file : workingDirectoryFiles) {</span>
-<span class="pc bpc" id="L251" title="1 of 2 branches missed.">            if (file.getName().contains(&quot;src&quot;)) {</span>
-<span class="nc" id="L252">                copy = new File(scmSourceRoot + &quot;/&quot; + file.getName());</span>
-<span class="nc" id="L253">                SharedFunctions.copyFile(getLog(), file, copy);</span>
-<span class="nc" id="L254">                filesForMavenScmFileSet.add(copy);</span>
-<span class="pc bpc" id="L255" title="1 of 2 branches missed.">            } else if (file.getName().contains(&quot;bin&quot;)) {</span>
-<span class="nc" id="L256">                copy = new File(scmBinariesRoot + &quot;/&quot; + file.getName());</span>
-<span class="nc" id="L257">                SharedFunctions.copyFile(getLog(), file, copy);</span>
-<span class="nc" id="L258">                filesForMavenScmFileSet.add(copy);</span>
-<span class="fc bfc" id="L259" title="All 2 branches covered.">            } else if (file.getName().contains(&quot;scm&quot;)) {</span>
-<span class="fc" id="L260">                getLog().debug(&quot;Not copying scm directory over to the scm directory because it is the scm directory.&quot;);</span>
+<span class="fc bfc" id="L312" title="All 2 branches covered.">        for (File file : workingDirectoryFiles) {</span>
+<span class="fc bfc" id="L313" title="All 2 branches covered.">            if (file.getName().contains(&quot;src&quot;)) {</span>
+<span class="fc" id="L314">                copy = new File(scmSourceRoot,  file.getName());</span>
+<span class="fc" id="L315">                SharedFunctions.copyFile(getLog(), file, copy);</span>
+<span class="fc" id="L316">                filesForMavenScmFileSet.add(file);</span>
+<span class="fc bfc" id="L317" title="All 2 branches covered.">            } else if (file.getName().contains(&quot;bin&quot;)) {</span>
+<span class="fc" id="L318">                copy = new File(scmBinariesRoot,  file.getName());</span>
+<span class="fc" id="L319">                SharedFunctions.copyFile(getLog(), file, copy);</span>
+<span class="fc" id="L320">                filesForMavenScmFileSet.add(file);</span>
+<span class="pc bpc" id="L321" title="1 of 2 branches missed.">            } else if (StringUtils.containsAny(file.getName(), &quot;scm&quot;, &quot;sha1.properties&quot;, &quot;sha256.properties&quot;)) {</span>
+<span class="fc" id="L322">                getLog().debug(&quot;Not copying scm directory over to the scm directory because it is the scm directory.&quot;);</span>
                 //do nothing because we are copying into scm
             } else {
-<span class="fc" id="L263">                copy = new File(distCheckoutDirectory.getAbsolutePath() + &quot;/&quot; + file.getName());</span>
-<span class="fc" id="L264">                SharedFunctions.copyFile(getLog(), file, copy);</span>
-<span class="fc" id="L265">                filesForMavenScmFileSet.add(copy);</span>
+<span class="nc" id="L325">                copy = new File(distCheckoutDirectory.getAbsolutePath(),  file.getName());</span>
+<span class="nc" id="L326">                SharedFunctions.copyFile(getLog(), file, copy);</span>
+<span class="nc" id="L327">                filesForMavenScmFileSet.add(file);</span>
             }
-<span class="fc" id="L267">        }</span>
-<span class="fc" id="L268">        filesForMavenScmFileSet.add(copiedReleaseNotes);</span>
-<span class="fc" id="L269">        return filesForMavenScmFileSet;</span>
+<span class="fc" id="L329">        }</span>
+<span class="fc" id="L330">        filesForMavenScmFileSet.addAll(buildReadmeAndHeaderHtmlFiles());</span>
+<span class="fc" id="L331">        filesForMavenScmFileSet.addAll(copySiteToScmDirectory());</span>
+<span class="fc" id="L332">        return filesForMavenScmFileSet;</span>
     }
 
     /**
-     * Build the path for the distribution binaries directory.
+     * Copies &lt;code&gt;${basedir}/target/site&lt;/code&gt; to &lt;code&gt;${basedir}/target/commons-release-plugin/scm/site&lt;/code&gt;.
      *
-     * @return the local absolute path into the checkedout subversion repository that is where
-     *         the binaries distributions are to be copied.
-     */
-    private String buildDistBinariesRoot() {
-<span class="fc" id="L279">        StringBuffer buffer = new StringBuffer(distCheckoutDirectory.getAbsolutePath());</span>
-<span class="fc" id="L280">        buffer.append(&quot;/binaries&quot;);</span>
-<span class="fc" id="L281">        return buffer.toString();</span>
+     * @return the {@link List} of {@link File}'s contained in
+     *         &lt;code&gt;${basedir}/target/commons-release-plugin/scm/site&lt;/code&gt;, after the copy is complete.
+     * @throws MojoExecutionException if the site copying fails for some reason.
+     */
+    private List&lt;File&gt; copySiteToScmDirectory() throws MojoExecutionException {
+<span class="pc bpc" id="L343" title="1 of 2 branches missed.">        if (!siteDirectory.exists()) {</span>
+<span class="nc" id="L344">            getLog().error(&quot;\&quot;mvn site\&quot; was not run before this goal, or a siteDirectory did not exist.&quot;);</span>
+<span class="nc" id="L345">            throw new MojoExecutionException(</span>
+                    &quot;\&quot;mvn site\&quot; was not run before this goal, or a siteDirectory did not exist.&quot;
+            );
+        }
+        try {
+<span class="fc" id="L350">            FileUtils.copyDirectoryToDirectory(siteDirectory, distVersionRcVersionDirectory);</span>
+<span class="nc" id="L351">        } catch (IOException e) {</span>
+<span class="nc" id="L352">            throw new MojoExecutionException(&quot;Site copying failed&quot;, e);</span>
+<span class="fc" id="L353">        }</span>
+<span class="fc" id="L354">        File siteInScm = new File(distVersionRcVersionDirectory, &quot;site&quot;);</span>
+<span class="fc" id="L355">        return new ArrayList&lt;&gt;(FileUtils.listFiles(siteInScm, null, true));</span>
     }
 
     /**
-     * Build the path for the distribution source directory.
+     * Builds up &lt;code&gt;README.html&lt;/code&gt; and &lt;code&gt;HEADER.html&lt;/code&gt; that reside in following.
+     * &lt;ul&gt;
+     *     &lt;li&gt;distRoot
+     *     &lt;ul&gt;
+     *         &lt;li&gt;binaries/HEADER.html (symlink)&lt;/li&gt;
+     *         &lt;li&gt;binaries/README.html (symlink)&lt;/li&gt;
+     *         &lt;li&gt;source/HEADER.html (symlink)&lt;/li&gt;
+     *         &lt;li&gt;source/README.html (symlink)&lt;/li&gt;
+     *         &lt;li&gt;HEADER.html&lt;/li&gt;
+     *         &lt;li&gt;README.html&lt;/li&gt;
+     *     &lt;/ul&gt;
+     *     &lt;/li&gt;
+     * &lt;/ul&gt;
+     * @return the {@link List} of created files above
+     * @throws MojoExecutionException if an {@link IOException} occurs in the creation of these
+     *                                files fails.
+     */
+    private List&lt;File&gt; buildReadmeAndHeaderHtmlFiles() throws MojoExecutionException {
+<span class="fc" id="L377">        List&lt;File&gt; headerAndReadmeFiles = new ArrayList&lt;&gt;();</span>
+<span class="fc" id="L378">        File headerFile = new File(distVersionRcVersionDirectory, HEADER_FILE_NAME);</span>
+        //
+        // HEADER file
+        //
+<span class="fc" id="L382">        try (Writer headerWriter = new OutputStreamWriter(new FileOutputStream(headerFile), &quot;UTF-8&quot;)) {</span>
+<span class="fc" id="L383">            HeaderHtmlVelocityDelegate.builder().build().render(headerWriter);</span>
+<span class="nc" id="L384">        } catch (IOException e) {</span>
+<span class="nc" id="L385">            final String message = &quot;Could not build HEADER html file &quot; + headerFile;</span>
+<span class="nc" id="L386">            getLog().error(message, e);</span>
+<span class="nc" id="L387">            throw new MojoExecutionException(message, e);</span>
+<span class="fc" id="L388">        }</span>
+<span class="fc" id="L389">        headerAndReadmeFiles.add(headerFile);</span>
+        //
+        // README file
+        //
+<span class="fc" id="L393">        File readmeFile = new File(distVersionRcVersionDirectory, README_FILE_NAME);</span>
+<span class="fc" id="L394">        try (Writer readmeWriter = new OutputStreamWriter(new FileOutputStream(readmeFile), &quot;UTF-8&quot;)) {</span>
+            // @formatter:off
+<span class="fc" id="L396">            ReadmeHtmlVelocityDelegate readmeHtmlVelocityDelegate = ReadmeHtmlVelocityDelegate.builder()</span>
+<span class="fc" id="L397">                    .withArtifactId(project.getArtifactId())</span>
+<span class="fc" id="L398">                    .withVersion(project.getVersion())</span>
+<span class="fc" id="L399">                    .withSiteUrl(project.getUrl())</span>
+<span class="fc" id="L400">                    .build();</span>
+            // @formatter:on
+<span class="fc" id="L402">            readmeHtmlVelocityDelegate.render(readmeWriter);</span>
+<span class="nc" id="L403">        } catch (IOException e) {</span>
+<span class="nc" id="L404">            final String message = &quot;Could not build README html file &quot; + readmeFile;</span>
+<span class="nc" id="L405">            getLog().error(message, e);</span>
+<span class="nc" id="L406">            throw new MojoExecutionException(message, e);</span>
+<span class="fc" id="L407">        }</span>
+<span class="fc" id="L408">        headerAndReadmeFiles.add(readmeFile);</span>
+<span class="fc" id="L409">        headerAndReadmeFiles.addAll(copyHeaderAndReadmeToSubdirectories(headerFile, readmeFile));</span>
+<span class="fc" id="L410">        return headerAndReadmeFiles;</span>
+    }
+
+    /**
+     * Copies &lt;code&gt;README.html&lt;/code&gt; and &lt;code&gt;HEADER.html&lt;/code&gt; to the source and binaries
+     * directories.
      *
-     * @return the local absolute path into the checkedout subversion repository that is where
-     *         the source distributions are to be copied.
+     * @param headerFile The originally created &lt;code&gt;HEADER.html&lt;/code&gt; file.
+     * @param readmeFile The originally created &lt;code&gt;README.html&lt;/code&gt; file.
+     * @return a {@link List} of created files.
+     * @throws MojoExecutionException if the {@link SharedFunctions#copyFile(Log, File, File)}
+     *                                fails.
      */
-    private String buildDistSourceRoot() {
-<span class="fc" id="L291">        StringBuffer buffer = new StringBuffer(distCheckoutDirectory.getAbsolutePath());</span>
-<span class="fc" id="L292">        buffer.append(&quot;/source&quot;);</span>
-<span class="fc" id="L293">        return buffer.toString();</span>
+    private List&lt;File&gt; copyHeaderAndReadmeToSubdirectories(File headerFile, File readmeFile)
+            throws MojoExecutionException {
+<span class="fc" id="L425">        List&lt;File&gt; symbolicLinkFiles = new ArrayList&lt;&gt;();</span>
+<span class="fc" id="L426">        File sourceRoot = new File(distVersionRcVersionDirectory, &quot;source&quot;);</span>
+<span class="fc" id="L427">        File binariesRoot = new File(distVersionRcVersionDirectory, &quot;binaries&quot;);</span>
+<span class="fc" id="L428">        File sourceHeaderFile = new File(sourceRoot, HEADER_FILE_NAME);</span>
+<span class="fc" id="L429">        File sourceReadmeFile = new File(sourceRoot, README_FILE_NAME);</span>
+<span class="fc" id="L430">        File binariesHeaderFile = new File(binariesRoot, HEADER_FILE_NAME);</span>
+<span class="fc" id="L431">        File binariesReadmeFile = new File(binariesRoot, README_FILE_NAME);</span>
+<span class="fc" id="L432">        SharedFunctions.copyFile(getLog(), headerFile, sourceHeaderFile);</span>
+<span class="fc" id="L433">        symbolicLinkFiles.add(sourceHeaderFile);</span>
+<span class="fc" id="L434">        SharedFunctions.copyFile(getLog(), readmeFile, sourceReadmeFile);</span>
+<span class="fc" id="L435">        symbolicLinkFiles.add(sourceReadmeFile);</span>
+<span class="fc" id="L436">        SharedFunctions.copyFile(getLog(), headerFile, binariesHeaderFile);</span>
+<span class="fc" id="L437">        symbolicLinkFiles.add(binariesHeaderFile);</span>
+<span class="fc" id="L438">        SharedFunctions.copyFile(getLog(), readmeFile, binariesReadmeFile);</span>
+<span class="fc" id="L439">        symbolicLinkFiles.add(binariesReadmeFile);</span>
+<span class="fc" id="L440">        return symbolicLinkFiles;</span>
     }
 
     /**
-     * This method is the setter for the {@link CommonsDistributionStagingMojo#basedir} field, specifically
+     * This method is the setter for the {@link CommonsDistributionStagingMojo#baseDir} field, specifically
      * for the usage in the unit tests.
      *
-     * @param basedir is the {@link File} to be used as the project's root directory when this mojo
+     * @param baseDir is the {@link File} to be used as the project's root directory when this mojo
      *                is invoked.
      */
-    protected void setBasedir(File basedir) {
-<span class="fc" id="L304">        this.basedir = basedir;</span>
-<span class="fc" id="L305">    }</span>
+    protected void setBaseDir(File baseDir) {
+<span class="fc" id="L451">        this.baseDir = baseDir;</span>
+<span class="fc" id="L452">    }</span>
 }
 </pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.0.201801022044</span></div></body></html>
\ No newline at end of file