You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ch...@apache.org on 2018/01/07 22:15:49 UTC

commons-release-plugin git commit: (chore) cleanup from detatch -> detach (I'm bad at spelling)

Repository: commons-release-plugin
Updated Branches:
  refs/heads/master a47b6c062 -> 919f44a44


(chore) cleanup from detatch -> detach (I'm bad at spelling)


Project: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/commit/919f44a4
Tree: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/tree/919f44a4
Diff: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/diff/919f44a4

Branch: refs/heads/master
Commit: 919f44a44780ea7f1e4062054f01e79fcb698130
Parents: a47b6c0
Author: Rob Tompkins <ch...@gmail.com>
Authored: Sun Jan 7 17:15:39 2018 -0500
Committer: Rob Tompkins <ch...@gmail.com>
Committed: Sun Jan 7 17:15:39 2018 -0500

----------------------------------------------------------------------
 .../CommonsDistributionDetachmentMojo.java      | 154 +++++++++++++++++++
 .../CommonsDistributionDetachmentMojoTest.java  |  75 +++++++++
 .../CommonsDistributionStagingMojoTest.java     |  68 ++++++++
 .../DistributionDetachmentProjectStub.java      |  92 +++++++++++
 .../detach-distributions.xml                    |  52 +++++++
 .../mojos/stage-distributions/RELEASE-NOTES.txt |  20 +++
 .../stage-distributions/stage-distributions.xml |  54 +++++++
 7 files changed, 515 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/919f44a4/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java
new file mode 100644
index 0000000..4d99942
--- /dev/null
+++ b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java
@@ -0,0 +1,154 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.release.plugin.mojos;
+
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.release.plugin.SharedFunctions;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.artifact.Artifact;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.*;
+
+/**
+ * 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.
+ *
+ * @author chtompki
+ * @since 1.0
+ */
+@Mojo( name = "detach-distributions", defaultPhase = LifecyclePhase.VERIFY, threadSafe = true)
+public class CommonsDistributionDetachmentMojo extends AbstractMojo {
+
+    /**
+     * A list of "artifact types" 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 detatched
+     * from the deployment, namely *-src.zip, *-src.tar.gz, *-bin.zip,
+     * *-bin.tar.gz, and the corresponding .asc pgp signatures.
+     */
+    private static final Set<String> ARTIFACT_TYPES_TO_DETATCH;
+    static {
+        Set<String> hashSet = new HashSet<>();
+        hashSet.add("zip");
+        hashSet.add("tar.gz");
+        hashSet.add("zip.asc");
+        hashSet.add("tar.gz.asc");
+        ARTIFACT_TYPES_TO_DETATCH = Collections.unmodifiableSet(hashSet);
+    }
+
+    /**
+     * 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 detatched from the maven deployment.
+     */
+    private List<Artifact> detatchedArtifacts = new ArrayList<>();
+
+    /**
+     * The maven project context injection so that we can get a hold of the variables at hand.
+     */
+    @Parameter( defaultValue = "${project}", required = true )
+    private MavenProject project;
+
+    /**
+     */
+    @Parameter( defaultValue = "${project.build.directory}/commons-release-plugin", alias = "outputDirectory" )
+    private File workingDirectory;
+
+    /**
+     */
+    @Parameter(required = true)
+    private String distSvnStagingUrl;
+
+    public void execute() throws MojoExecutionException {
+        getLog().info("Detatching Assemblies");
+        for (Object attachedArtifact : project.getAttachedArtifacts()) {
+            if (ARTIFACT_TYPES_TO_DETATCH.contains(((Artifact) attachedArtifact).getType())) {
+                detatchedArtifacts.add((Artifact) attachedArtifact);
+            }
+        }
+        for(Artifact artifactToRemove : detatchedArtifacts) {
+            project.getAttachedArtifacts().remove(artifactToRemove);
+        }
+        if (!workingDirectory.exists()) {
+            SharedFunctions.initDirectory(getLog(), workingDirectory);
+        }
+        copyRemovedArtifactsToWorkingDirectory();
+        getLog().info("");
+        sha1AndMd5SignArtifacts();
+    }
+
+    private void copyRemovedArtifactsToWorkingDirectory() throws MojoExecutionException {
+        StringBuffer copiedArtifactAbsolutePath;
+        getLog().info("Copying detatched artifacts to working directory.");
+        for (Artifact artifact: detatchedArtifacts) {
+            File artifactFile = artifact.getFile();
+            copiedArtifactAbsolutePath = new StringBuffer(workingDirectory.getAbsolutePath());
+            copiedArtifactAbsolutePath.append("/");
+            copiedArtifactAbsolutePath.append(artifactFile.getName());
+            File copiedArtifact = new File(copiedArtifactAbsolutePath.toString());
+            getLog().info("Copying: " + artifactFile.getName());
+            SharedFunctions.copyFile(getLog(), artifactFile, copiedArtifact);
+        }
+    }
+
+    private void sha1AndMd5SignArtifacts() throws MojoExecutionException {
+        for (Artifact artifact : detatchedArtifacts) {
+            if (!artifact.getFile().getName().contains("asc")) {
+                try {
+                    FileInputStream artifactFileInputStream = new FileInputStream(artifact.getFile());
+                    String md5 = DigestUtils.md5Hex(artifactFileInputStream);
+                    getLog().info(artifact.getFile().getName() + " md5: " + md5);
+                    PrintWriter md5Writer = new PrintWriter(getMd5FilePath(workingDirectory, artifact.getFile()));
+                    md5Writer.println(md5);
+                    String sha1 = DigestUtils.sha1Hex(artifactFileInputStream);
+                    getLog().info(artifact.getFile().getName() + " sha1: " + sha1);
+                    PrintWriter sha1Writer = new PrintWriter(getSha1FilePath(workingDirectory, artifact.getFile()));
+                    sha1Writer.println(sha1);
+                    md5Writer.close();
+                    sha1Writer.close();
+                } catch (IOException e) {
+                    throw new MojoExecutionException("Could not sign file: " + artifact.getFile().getName(), e);
+                }
+            }
+        }
+    }
+
+    private String getMd5FilePath(File workingDirectory, File file) {
+        StringBuffer buffer = new StringBuffer(workingDirectory.getAbsolutePath());
+        buffer.append("/");
+        buffer.append(file.getName());
+        buffer.append(".md5");
+        return buffer.toString();
+    }
+
+    private String getSha1FilePath(File workingDirectory, File file) {
+        StringBuffer buffer = new StringBuffer(workingDirectory.getAbsolutePath());
+        buffer.append("/");
+        buffer.append(file.getName());
+        buffer.append(".sha1");
+        return buffer.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/919f44a4/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojoTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojoTest.java b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojoTest.java
new file mode 100644
index 0000000..cfa5c48
--- /dev/null
+++ b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojoTest.java
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.release.plugin.mojos;
+
+import org.apache.maven.plugin.testing.MojoRule;
+import org.junit.Rule;
+import org.junit.Test;
+
+import java.io.File;
+
+import static junit.framework.TestCase.assertTrue;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * Unit tests for {@link CommonsDistributionDetachmentMojo}.
+ *
+ * @author chtompki
+ */
+public class CommonsDistributionDetachmentMojoTest {
+
+    @Rule
+    public MojoRule rule = new MojoRule() {
+        @Override
+        protected void before() throws Throwable {
+        }
+
+        @Override
+        protected void after() {
+        }
+    };
+
+    private CommonsDistributionDetachmentMojo mojo;
+
+    @Test
+    public void testSuccess() throws Exception {
+        File testPom = new File("src/test/resources/mojos/detach-distributions/detach-distributions.xml");
+        assertNotNull(testPom);
+        assertTrue(testPom.exists());
+        mojo = (CommonsDistributionDetachmentMojo) rule.lookupMojo("detach-distributions", testPom);
+        mojo.execute();
+        File detachedTarGz = new File("target/commons-release-plugin/mockAttachedTar.tar.gz");
+        File detachedTarGzAsc = new File("target/commons-release-plugin/mockAttachedTar.tar.gz.asc");
+        File detachedTarMd5 = new File("target/commons-release-plugin/mockAttachedTar.tar.gz.md5");
+        File detachedTarGzSha1 = new File("target/commons-release-plugin/mockAttachedTar.tar.gz.sha1");
+        File detachedZip = new File("target/commons-release-plugin/mockAttachedZip.zip");
+        File detachedZipAsc = new File("target/commons-release-plugin/mockAttachedZip.zip.asc");
+        File detachedZipMd5 = new File("target/commons-release-plugin/mockAttachedZip.zip.md5");
+        File detachedZipSha1 = new File("target/commons-release-plugin/mockAttachedZip.zip.sha1");
+        File notDetatchedMockAttachedFile = new File("target/commons-release-plugin/mockAttachedFile.html");
+        assertTrue(detachedTarGz.exists());
+        assertTrue(detachedTarGzAsc.exists());
+        assertTrue(detachedTarMd5.exists());
+        assertTrue(detachedTarGzSha1.exists());
+        assertTrue(detachedZip.exists());
+        assertTrue(detachedZipAsc.exists());
+        assertTrue(detachedZipMd5.exists());
+        assertTrue(detachedZipSha1.exists());
+        assertFalse(notDetatchedMockAttachedFile.exists());
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/919f44a4/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojoTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojoTest.java b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojoTest.java
new file mode 100644
index 0000000..99df08d
--- /dev/null
+++ b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojoTest.java
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.release.plugin.mojos;
+
+import org.apache.maven.plugin.testing.MojoRule;
+import org.junit.Rule;
+import org.junit.Test;
+
+import java.io.File;
+
+import static junit.framework.TestCase.assertTrue;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * Unit tests for {@link CommonsDistributionStagingMojo}.
+ *
+ * @author chtompki
+ * @since 1.0.
+ */
+public class CommonsDistributionStagingMojoTest {
+
+    @Rule
+    public MojoRule rule = new MojoRule() {
+        @Override
+        protected void before() throws Throwable {
+        }
+
+        @Override
+        protected void after() {
+        }
+    };
+
+    private CommonsDistributionDetachmentMojo detatchmentMojo;
+
+    private CommonsDistributionStagingMojo mojoForTest;
+
+    @Test
+    public void testSuccess() throws Exception {
+        File testPom = new File("src/test/resources/mojos/stage-distributions/stage-distributions.xml");
+        assertNotNull(testPom);
+        assertTrue(testPom.exists());
+        File detachmentPom = new File("src/test/resources/mojos/detach-distributions/detach-distributions.xml");
+        assertNotNull(detachmentPom);
+        assertTrue(detachmentPom.exists());
+        mojoForTest = (CommonsDistributionStagingMojo) rule.lookupMojo("stage-distributions", testPom);
+        detatchmentMojo = (CommonsDistributionDetachmentMojo) rule.lookupMojo("detach-distributions", detachmentPom);
+        detatchmentMojo.execute();
+        File releaseNotesBasedir = new File("src/test/resources/mojos/stage-distributions/");
+        mojoForTest.setBasedir(releaseNotesBasedir);
+        mojoForTest.execute();
+        File targetScmDirectory = new File ("target/commons-release-plugin/scm");
+        assertTrue(targetScmDirectory.exists());
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/919f44a4/src/test/java/org/apache/commons/release/plugin/stubs/DistributionDetachmentProjectStub.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/release/plugin/stubs/DistributionDetachmentProjectStub.java b/src/test/java/org/apache/commons/release/plugin/stubs/DistributionDetachmentProjectStub.java
new file mode 100644
index 0000000..da41efd
--- /dev/null
+++ b/src/test/java/org/apache/commons/release/plugin/stubs/DistributionDetachmentProjectStub.java
@@ -0,0 +1,92 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.release.plugin.stubs;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.testing.stubs.ArtifactStub;
+import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+import org.apache.maven.project.MavenProject;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Stub for {@link MavenProject} for the {@link CommonsDistributionDetachmentMojoTest}.
+ *
+ * @author chtompki
+ */
+public class DistributionDetachmentProjectStub extends MavenProjectStub {
+
+    private List<Artifact> attachedArtifacts;
+
+    @Override
+    public List<Artifact> getAttachedArtifacts() {
+        attachedArtifacts = new ArrayList<>();
+        attachedArtifacts.add(
+                new DistributionDetatchmentArtifactStub(
+                        new File("src/test/resources/mojos/detach-distributions/target/mockAttachedFile.html"),
+                        "html"
+                )
+        );
+        attachedArtifacts.add(
+                new DistributionDetatchmentArtifactStub(
+                        new File("src/test/resources/mojos/detach-distributions/target/mockAttachedTar.tar.gz"),
+                        "tar.gz"
+                )
+        );
+        attachedArtifacts.add(
+                new DistributionDetatchmentArtifactStub(
+                        new File("src/test/resources/mojos/detach-distributions/target/mockAttachedTar.tar.gz.asc"),
+                        "tar.gz.asc"
+                )
+        );
+        attachedArtifacts.add(
+                new DistributionDetatchmentArtifactStub(
+                        new File("src/test/resources/mojos/detach-distributions/target/mockAttachedZip.zip"),
+                        "zip"
+                )
+        );
+        attachedArtifacts.add(
+                new DistributionDetatchmentArtifactStub(
+                        new File("src/test/resources/mojos/detach-distributions/target/mockAttachedZip.zip.asc"),
+                        "zip.asc"
+                )
+        );
+        return attachedArtifacts;
+    }
+
+    public class DistributionDetatchmentArtifactStub extends ArtifactStub {
+
+        private File artifact;
+
+        private String type;
+
+        public DistributionDetatchmentArtifactStub(File file, String type) {
+            this.artifact = file;
+            this.type = type;
+        }
+
+        public File getFile() {
+            return this.artifact;
+        }
+
+        public String getType() {
+            return this.type;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/919f44a4/src/test/resources/mojos/detach-distributions/detach-distributions.xml
----------------------------------------------------------------------
diff --git a/src/test/resources/mojos/detach-distributions/detach-distributions.xml b/src/test/resources/mojos/detach-distributions/detach-distributions.xml
new file mode 100644
index 0000000..05a21ed
--- /dev/null
+++ b/src/test/resources/mojos/detach-distributions/detach-distributions.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.apache.commons.release.plugin.unit</groupId>
+    <artifactId>detatch-distributions-test</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <packaging>jar</packaging>
+    <name>Mock Pom For Testing CommonsDistributionDetatchmentMojo</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>3.8.1</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.commons</groupId>
+                <artifactId>commons-release-plugin</artifactId>
+                <configuration>
+                    <project implementation="org.apache.commons.release.plugin.stubs.DistributionDetachmentProjectStub" />
+                    <workingDirectory>target/commons-release-plugin</workingDirectory>
+                    <distSvnStagingUrl>mockDistSvnStagingUrl</distSvnStagingUrl>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/919f44a4/src/test/resources/mojos/stage-distributions/RELEASE-NOTES.txt
----------------------------------------------------------------------
diff --git a/src/test/resources/mojos/stage-distributions/RELEASE-NOTES.txt b/src/test/resources/mojos/stage-distributions/RELEASE-NOTES.txt
new file mode 100644
index 0000000..8892de1
--- /dev/null
+++ b/src/test/resources/mojos/stage-distributions/RELEASE-NOTES.txt
@@ -0,0 +1,20 @@
+<!--
+  ~ 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.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+Mock Release Notes File for testing CommonsDistributionStagingMojo
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/919f44a4/src/test/resources/mojos/stage-distributions/stage-distributions.xml
----------------------------------------------------------------------
diff --git a/src/test/resources/mojos/stage-distributions/stage-distributions.xml b/src/test/resources/mojos/stage-distributions/stage-distributions.xml
new file mode 100644
index 0000000..1e24ed1
--- /dev/null
+++ b/src/test/resources/mojos/stage-distributions/stage-distributions.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.apache.commons.release.plugin.unit</groupId>
+    <artifactId>stage-distributions-test</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <packaging>jar</packaging>
+    <name>Mock Pom For Testing CommonsDistributionDetatchmentMojo</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>3.8.1</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.commons</groupId>
+                <artifactId>commons-release-plugin</artifactId>
+                <configuration>
+                    <project implementation="org.apache.commons.release.plugin.stubs.DistributionDetachmentProjectStub" />
+                    <workingDirectory>target/commons-release-plugin</workingDirectory>
+                    <distCheckoutDirectory>target/commons-release-plugin/scm</distCheckoutDirectory>
+                    <distSvnStagingUrl>scm:svn:https://dist.apache.org/repos/dist/dev/commons/release-plugin</distSvnStagingUrl>
+                    <dryRun>true</dryRun>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file