You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2018/08/26 18:14:58 UTC
[maven-deploy-plugin] 01/01: [MDEPLOY-231] - Move checksum
generation from install to deploy plugin
This is an automated email from the ASF dual-hosted git repository.
khmarbaise pushed a commit to branch MDEPLOY-231
in repository https://gitbox.apache.org/repos/asf/maven-deploy-plugin.git
commit 83b2d51cb3427a54ea465ff836c68da18accd426
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Thu Aug 9 17:24:14 2018 +0200
[MDEPLOY-231] - Move checksum generation from install to deploy plugin
---
pom.xml | 7 +-
src/it/attach-jar-checksum-release/pom.xml | 103 +++++++++++++++++++++
src/it/attach-jar-checksum-release/setup.bsh | 29 ++++++
src/it/attach-jar-checksum-release/verify.groovy | 64 +++++++++++++
src/it/attach-jar-checksum-snapshot/pom.xml | 102 ++++++++++++++++++++
src/it/attach-jar-checksum-snapshot/setup.bsh | 29 ++++++
src/it/attach-jar-checksum-snapshot/verify.groovy | 95 +++++++++++++++++++
.../maven/plugins/deploy/DeployFileMojo.java | 8 +-
.../apache/maven/plugins/deploy/DeployMojo.java | 11 ++-
.../maven/plugins/deploy/DeployMojoTest.java | 2 +-
.../org/apache/maven/plugins/deploy/Utils.java | 64 +++++++++++++
.../plugins/deploy/stubs/ArtifactDeployerStub.java | 4 +-
12 files changed, 507 insertions(+), 11 deletions(-)
diff --git a/pom.xml b/pom.xml
index a0e0788..36cafaf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -91,7 +91,7 @@ under the License.
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-artifact-transfer</artifactId>
- <version>0.9.1</version>
+ <version>0.10.0</version>
</dependency>
<!-- Upgrade of transitive dependency. -->
<dependency>
@@ -185,9 +185,14 @@ under the License.
<postBuildHookScript>verify</postBuildHookScript>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
<settingsFile>src/it/settings.xml</settingsFile>
+ <addTestClassPath>true</addTestClassPath>
<goals>
<goal>deploy</goal>
</goals>
+ <properties>
+ <!-- e.g. ensure that Java7 picks up TLSv1.2 when connecting with Central -->
+ <https.protocols>${https.protocols}</https.protocols>
+ </properties>
</configuration>
</plugin>
</plugins>
diff --git a/src/it/attach-jar-checksum-release/pom.xml b/src/it/attach-jar-checksum-release/pom.xml
new file mode 100644
index 0000000..bda659d
--- /dev/null
+++ b/src/it/attach-jar-checksum-release/pom.xml
@@ -0,0 +1,103 @@
+<?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.maven.its.deploy.ajc</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0</version>
+ <packaging>jar</packaging>
+
+ <description>
+ This test has been moved from maven-install-plugin to maven-deploy-plugin.
+ Tests the installation of a simple snapshot JAR with an attached artifact and checksums
+ </description>
+
+ <properties>
+ <maven.test.skip>true</maven.test.skip>
+ </properties>
+ <distributionManagement>
+ <repository>
+ <id>it</id>
+ <url>file:///${basedir}/target/remoterepo</url>
+ </repository>
+ </distributionManagement>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+ <!--
+ ! This is intentionally the old version which
+ ! will not create checksums by default.
+ ! We want to make sure that only maven-deploy-plugin
+ ! will generate the checksums.
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <version>2.5.2</version>
+ <configuration>
+ <createChecksum>false</createChecksum>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.0.4</version>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.3.1</version>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/src/it/attach-jar-checksum-release/setup.bsh b/src/it/attach-jar-checksum-release/setup.bsh
new file mode 100644
index 0000000..4d73971
--- /dev/null
+++ b/src/it/attach-jar-checksum-release/setup.bsh
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+import java.io.*;
+import java.util.*;
+
+import org.codehaus.plexus.util.*;
+
+File file = new File( basedir, "org/apache/maven/its/deploy/ajc" );
+System.out.println( "Deleting " + file );
+FileUtils.deleteDirectory( file );
+
+return true;
diff --git a/src/it/attach-jar-checksum-release/verify.groovy b/src/it/attach-jar-checksum-release/verify.groovy
new file mode 100644
index 0000000..ac362f8
--- /dev/null
+++ b/src/it/attach-jar-checksum-release/verify.groovy
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+
+import java.io.*;
+import java.util.*;
+
+import org.apache.maven.plugins.deploy.Utils;
+
+def paths =
+[
+ "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.pom",
+ "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.pom.md5",
+ "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.pom.sha1",
+ "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.jar",
+ "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.jar.md5",
+ "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.jar.sha1",
+ "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0-sources.jar",
+ "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0-sources.jar.md5",
+ "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0-sources.jar.sha1",
+ "org/apache/maven/its/deploy/ajc/test/maven-metadata.xml",
+ "org/apache/maven/its/deploy/ajc/test/maven-metadata.xml.md5",
+ "org/apache/maven/its/deploy/ajc/test/maven-metadata.xml.sha1",
+]
+
+def cksumToCheckPaths = [
+ "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.pom",
+ "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.jar",
+ "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0-sources.jar"
+]
+
+// Check if artifacts have been uploaded to remote with checksums
+def repository = new File (basedir, "target/remoterepo" )
+paths.each { path ->
+ //File file = new File( localRepositoryPath, path );
+ File file = new File( repository, path );
+ println "Checking for existence of ${file}"
+ if ( !file.isFile() )
+ {
+ throw new FileNotFoundException( "Missing: " + file.getAbsolutePath() );
+ }
+ if ( cksumToCheckPaths.contains( path ) )
+ {
+ println "Verifying ${file}"
+ Utils.verifyChecksum( file );
+ }
+}
+
+return true;
diff --git a/src/it/attach-jar-checksum-snapshot/pom.xml b/src/it/attach-jar-checksum-snapshot/pom.xml
new file mode 100644
index 0000000..89ddce7
--- /dev/null
+++ b/src/it/attach-jar-checksum-snapshot/pom.xml
@@ -0,0 +1,102 @@
+<?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.maven.its.deploy.ajc</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <description>
+ Tests the deployment of a simple SNAPSHOT JAR with an attached artifact and checksums
+ </description>
+
+ <properties>
+ <maven.test.skip>true</maven.test.skip>
+ </properties>
+ <distributionManagement>
+ <repository>
+ <id>it</id>
+ <url>file:///${basedir}/target/remoterepo</url>
+ </repository>
+ </distributionManagement>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.1</version>
+ </plugin>
+ <!--
+ ! This is intentionally the old version which
+ ! will not create checksums by default.
+ ! We want to make sure that only maven-deploy-plugin
+ ! will generate the checksums.
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <version>2.5.2</version>
+ <configuration>
+ <createChecksum>false</createChecksum>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.0.4</version>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.3.1</version>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/src/it/attach-jar-checksum-snapshot/setup.bsh b/src/it/attach-jar-checksum-snapshot/setup.bsh
new file mode 100644
index 0000000..7d54f90
--- /dev/null
+++ b/src/it/attach-jar-checksum-snapshot/setup.bsh
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+import java.io.*;
+import java.util.*;
+
+import org.codehaus.plexus.util.*;
+
+File file = new File( basedir, "target/remoterepo/org/apache/maven/its/deploy/ajc" );
+System.out.println( "Deleting " + file );
+FileUtils.deleteDirectory( file );
+
+return true;
diff --git a/src/it/attach-jar-checksum-snapshot/verify.groovy b/src/it/attach-jar-checksum-snapshot/verify.groovy
new file mode 100644
index 0000000..0a4a14f
--- /dev/null
+++ b/src/it/attach-jar-checksum-snapshot/verify.groovy
@@ -0,0 +1,95 @@
+/*
+ * 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.
+ */
+
+import org.apache.maven.plugins.deploy.Utils;
+
+def pathsInTargetDirectory = [
+ "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.pom",
+ "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.pom\\.md5",
+ "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.pom\\.sha1",
+ "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.jar",
+ "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.jar\\.md5",
+ "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.jar\\.sha1",
+ "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\-sources\\.jar",
+ "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\-sources\\.jar\\.md5",
+ "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\-sources\\.jar\\.sha1",
+ //The following files will be generated. But they can't be check for the checksums
+ //cause they contain timestamps which means they change everytime.
+ "maven\\-metadata\\.xml",
+ "maven\\-metadata\\.xml\\.md5",
+ "maven\\-metadata\\.xml\\.sha1",
+]
+
+def checkSumsToCheckPaths = [
+ "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.pom",
+ "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.jar",
+ "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\-sources\\.jar",
+]
+
+// All files are being deployed to that location. See pom.xml
+def repository = new File (basedir, "target/remoterepo/org/apache/maven/its/deploy/ajc/test/1.0-SNAPSHOT" )
+
+// Read all files from the target directory.
+def filesInDirectory = []
+repository.eachFile() { file ->
+ filesInDirectory << file.getName()
+}
+
+println "Size: ${filesInDirectory.size()} / ${pathsInTargetDirectory.size()}"
+
+// First Step is to check the number of files found in directory against
+// the number of files we expect to find.
+if (filesInDirectory.size() != pathsInTargetDirectory.size()) {
+ throw new Exception( "The number of files in filesInDirectory and the number of files in pathsInTargetDirectory are not equal" );
+}
+
+// The following will check for the existence of all given
+// files based on the given regular expressions.
+// This is needed cause the time stamp in the file name
+// changes each time this test will be running.
+filesInDirectory.each { existingFile ->
+ def result = false
+ pathsInTargetDirectory.each { searchItem ->
+ def expected = existingFile ==~ searchItem
+ println "existingFile: ${existingFile} ${searchItem} expeced:${expected}"
+ if (expected) {
+ result = true
+ }
+ }
+
+ if (!result) {
+ throw new FileNotFoundException ( "Missing: ${existingFile}" )
+ }
+}
+
+// The following will check the existing checksums.
+filesInDirectory.each { existingFile ->
+ def result = false
+ checkSumsToCheckPaths.each { searchItem ->
+ //search for the file name pattern..
+ def expected = existingFile ==~ searchItem
+ if (expected) {
+ println "Verifying ${existingFile}"
+ Utils.verifyChecksum( new File(repository, existingFile) );
+ }
+ }
+}
+
+return true;
+
diff --git a/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java b/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
index 23014bb..4304421 100644
--- a/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
+++ b/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
@@ -54,10 +54,10 @@ import org.apache.maven.project.MavenProjectHelper;
import org.apache.maven.project.ProjectBuilder;
import org.apache.maven.project.ProjectBuildingException;
import org.apache.maven.project.artifact.ProjectArtifactMetadata;
-import org.apache.maven.shared.artifact.DefaultArtifactCoordinate;
-import org.apache.maven.shared.artifact.deploy.ArtifactDeployer;
-import org.apache.maven.shared.artifact.deploy.ArtifactDeployerException;
-import org.apache.maven.shared.repository.RepositoryManager;
+import org.apache.maven.shared.transfer.artifact.DefaultArtifactCoordinate;
+import org.apache.maven.shared.transfer.artifact.deploy.ArtifactDeployer;
+import org.apache.maven.shared.transfer.artifact.deploy.ArtifactDeployerException;
+import org.apache.maven.shared.transfer.repository.RepositoryManager;
import org.apache.maven.shared.utils.Os;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;
diff --git a/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java b/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
index 72d672f..94b9405 100644
--- a/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
+++ b/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
@@ -36,9 +36,10 @@ import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.ProjectBuildingRequest;
-import org.apache.maven.shared.project.NoFileAssignedException;
-import org.apache.maven.shared.project.deploy.ProjectDeployer;
-import org.apache.maven.shared.project.deploy.ProjectDeployerRequest;
+import org.apache.maven.shared.transfer.artifact.deploy.ArtifactDeployerException;
+import org.apache.maven.shared.transfer.project.NoFileAssignedException;
+import org.apache.maven.shared.transfer.project.deploy.ProjectDeployer;
+import org.apache.maven.shared.transfer.project.deploy.ProjectDeployerRequest;
/**
* Deploys an artifact to remote repository.
@@ -195,6 +196,10 @@ public class DeployMojo
{
throw new MojoExecutionException( "NoFileAssignedException", e );
}
+ catch ( ArtifactDeployerException e )
+ {
+ throw new MojoExecutionException( "ArtifactDeployerException", e );
+ }
}
diff --git a/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java b/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java
index 746be91..6c6f938 100644
--- a/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java
@@ -40,7 +40,7 @@ import org.apache.maven.plugins.deploy.stubs.DeployArtifactStub;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.repository.internal.MavenRepositorySystemSession;
-import org.apache.maven.shared.project.deploy.ProjectDeployerRequest;
+import org.apache.maven.shared.transfer.project.deploy.ProjectDeployerRequest;
import org.codehaus.plexus.util.FileUtils;
import org.junit.Ignore;
import org.mockito.InjectMocks;
diff --git a/src/test/java/org/apache/maven/plugins/deploy/Utils.java b/src/test/java/org/apache/maven/plugins/deploy/Utils.java
new file mode 100644
index 0000000..09949a6
--- /dev/null
+++ b/src/test/java/org/apache/maven/plugins/deploy/Utils.java
@@ -0,0 +1,64 @@
+package org.apache.maven.plugins.deploy;
+
+/*
+ * 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.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.sonatype.aether.util.ChecksumUtils;
+
+/**
+ * A utility class to assist testing.
+ *
+ * @author Benjamin Bentmann
+ * @version $Id$
+ */
+public class Utils
+{
+
+ public static final List<String> CHECKSUM_ALGORITHMS = Arrays.asList( "MD5", "SHA-1" );
+
+ /**
+ * Verifies the checksum files in the local repo for the given file.
+ *
+ * @param file The file to verify its checksum with, must not be <code>null</code>.
+ * @throws MojoExecutionException In case the checksums were incorrect.
+ * @throws IOException If the files couldn't be read.
+ */
+ public static void verifyChecksum( File file )
+ throws MojoExecutionException, IOException
+ {
+ Map<String, Object> checksums = ChecksumUtils.calc( file, CHECKSUM_ALGORITHMS );
+ for ( Map.Entry<String, Object> entry : checksums.entrySet() )
+ {
+ File cksumFile = new File( file + "." + entry.getKey().toLowerCase().replace( "-", "" ) );
+ String actualChecksum = ChecksumUtils.read( cksumFile );
+ if ( !actualChecksum.equals( entry.getValue() ) )
+ {
+ throw new MojoExecutionException( "Incorrect " + entry.getKey() + " checksum for file: " + file );
+ }
+ }
+ }
+
+}
diff --git a/src/test/java/org/apache/maven/plugins/deploy/stubs/ArtifactDeployerStub.java b/src/test/java/org/apache/maven/plugins/deploy/stubs/ArtifactDeployerStub.java
index 9bdf48a..d0b47d4 100644
--- a/src/test/java/org/apache/maven/plugins/deploy/stubs/ArtifactDeployerStub.java
+++ b/src/test/java/org/apache/maven/plugins/deploy/stubs/ArtifactDeployerStub.java
@@ -24,8 +24,8 @@ import java.util.Collection;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.project.ProjectBuildingRequest;
-import org.apache.maven.shared.artifact.deploy.ArtifactDeployer;
-import org.apache.maven.shared.artifact.deploy.ArtifactDeployerException;
+import org.apache.maven.shared.transfer.artifact.deploy.ArtifactDeployer;
+import org.apache.maven.shared.transfer.artifact.deploy.ArtifactDeployerException;
public class ArtifactDeployerStub
implements ArtifactDeployer