You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gb...@apache.org on 2016/10/08 20:06:43 UTC

svn commit: r1763933 - in /maven/plugins/trunk/maven-install-plugin: ./ src/it/attach-jar-checksum/ src/it/generate-pom-auto-1/ src/it/jar-sources-javadoc/ src/it/local-repo-override-with-checksum/ src/it/pom-checksum/ src/main/java/org/apache/maven/pl...

Author: gboue
Date: Sat Oct  8 20:06:42 2016
New Revision: 1763933

URL: http://svn.apache.org/viewvc?rev=1763933&view=rev
Log:
[MINSTALL-128] Replace usage of the deprecated ArtifactFactory

In order to fix the use of deprecated code from ArtifactFactory, the install-file Mojo now creates a new MavenProject and attaches to this project all artifacts to install.

Added:
    maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/
    maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/invoker.properties   (with props)
    maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/pom.xml   (with props)
    maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/setup.bsh   (with props)
    maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/test.jar   (with props)
    maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/test.properties   (with props)
    maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/verify.bsh   (with props)
Removed:
    maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/DualDigester.java
    maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/DualDigesterTest.java
    maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/SimpleDigester.java
    maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/testingharness/
    maven/plugins/trunk/maven-install-plugin/src/test/resources/META-INF/plexus/components.xml
Modified:
    maven/plugins/trunk/maven-install-plugin/pom.xml
    maven/plugins/trunk/maven-install-plugin/src/it/attach-jar-checksum/verify.bsh
    maven/plugins/trunk/maven-install-plugin/src/it/generate-pom-auto-1/verify.bsh
    maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/verify.bsh
    maven/plugins/trunk/maven-install-plugin/src/it/pom-checksum/verify.bsh
    maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/AbstractInstallMojo.java
    maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java
    maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallFileMojoTest.java
    maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallMojoTest.java
    maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/Utils.java

Modified: maven/plugins/trunk/maven-install-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/pom.xml?rev=1763933&r1=1763932&r2=1763933&view=diff
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-install-plugin/pom.xml Sat Oct  8 20:06:42 2016
@@ -110,12 +110,6 @@
       <artifactId>maven-plugin-testing-harness</artifactId>
       <version>2.1</version>
       <scope>test</scope>
-      <exclusions>
-        <exclusion>
-          <artifactId>plexus-container-default</artifactId>
-          <groupId>org.codehaus.plexus</groupId>
-        </exclusion>
-      </exclusions>
     </dependency>
     <dependency> <!-- used by maven-plugin-testing-harness, don't give it compile scope! -->
       <groupId>org.apache.maven</groupId>

Modified: maven/plugins/trunk/maven-install-plugin/src/it/attach-jar-checksum/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/attach-jar-checksum/verify.bsh?rev=1763933&r1=1763932&r2=1763933&view=diff
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/attach-jar-checksum/verify.bsh (original)
+++ maven/plugins/trunk/maven-install-plugin/src/it/attach-jar-checksum/verify.bsh Sat Oct  8 20:06:42 2016
@@ -20,7 +20,7 @@
 import java.io.*;
 import java.util.*;
 
-import org.apache.maven.plugin.install.*;
+import org.apache.maven.plugin.install.Utils;
 
 String[] paths =
 {
@@ -34,13 +34,16 @@ String[] paths =
     "org/apache/maven/its/install/ajc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT-sources.jar.md5",
     "org/apache/maven/its/install/ajc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT-sources.jar.sha1",
     "org/apache/maven/its/install/ajc/test/1.0-SNAPSHOT/maven-metadata-local.xml",
-//    "org/apache/maven/its/install/ajc/test/1.0-SNAPSHOT/maven-metadata-local.xml.md5",
-//    "org/apache/maven/its/install/ajc/test/1.0-SNAPSHOT/maven-metadata-local.xml.sha1",
     "org/apache/maven/its/install/ajc/test/maven-metadata-local.xml",
-//    "org/apache/maven/its/install/ajc/test/maven-metadata-local.xml.md5",
-//    "org/apache/maven/its/install/ajc/test/maven-metadata-local.xml.sha1",
 };
 
+Set cksumToCheckPaths = new HashSet( Arrays.asList( new String[]
+{
+    "org/apache/maven/its/install/ajc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.pom",
+    "org/apache/maven/its/install/ajc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.jar",
+    "org/apache/maven/its/install/ajc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT-sources.jar"
+} ) );
+
 for ( String path : paths )
 {
     File file = new File( localRepositoryPath, path );
@@ -49,8 +52,8 @@ for ( String path : paths )
     {
         throw new FileNotFoundException( "Missing: " + file.getAbsolutePath() );
     }
-    if ( file.getName().endsWith( ".md5" ) || file.getName().endsWith( ".sha1" ) )
-    {
+    if ( cksumToCheckPaths.contains( path ) )
+    {    
         System.out.println( "Verifying " + file );
         Utils.verifyChecksum( file );
     }

Modified: maven/plugins/trunk/maven-install-plugin/src/it/generate-pom-auto-1/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/generate-pom-auto-1/verify.bsh?rev=1763933&r1=1763932&r2=1763933&view=diff
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/generate-pom-auto-1/verify.bsh (original)
+++ maven/plugins/trunk/maven-install-plugin/src/it/generate-pom-auto-1/verify.bsh Sat Oct  8 20:06:42 2016
@@ -20,13 +20,11 @@
 import java.io.*;
 import java.util.*;
 
-import org.apache.maven.plugin.install.*;
+import org.apache.maven.plugin.install.Utils;
 
 String[] paths =
 {
     "org/apache/maven/its/install/gpa1/test/maven-metadata-local.xml",
-//    "org/apache/maven/its/install/gpa1/test/maven-metadata-local.xml.md5",
-//    "org/apache/maven/its/install/gpa1/test/maven-metadata-local.xml.sha1",
     "org/apache/maven/its/install/gpa1/test/0.1/test-0.1.jar",
     "org/apache/maven/its/install/gpa1/test/0.1/test-0.1.jar.md5",
     "org/apache/maven/its/install/gpa1/test/0.1/test-0.1.jar.sha1",
@@ -35,6 +33,12 @@ String[] paths =
     "org/apache/maven/its/install/gpa1/test/0.1/test-0.1.pom.sha1",
 };
 
+Set cksumToCheckPaths = new HashSet( Arrays.asList( new String[]
+{
+    "org/apache/maven/its/install/gpa1/test/0.1/test-0.1.jar",
+    "org/apache/maven/its/install/gpa1/test/0.1/test-0.1.pom",
+} ) );
+
 for ( String path : paths )
 {
     File file = new File( localRepositoryPath, path );
@@ -43,8 +47,8 @@ for ( String path : paths )
     {
         throw new FileNotFoundException( "Missing: " + file.getAbsolutePath() );
     }
-    if ( file.getName().endsWith( ".md5" ) || file.getName().endsWith( ".sha1" ) )
-    {
+    if ( cksumToCheckPaths.contains( path ) )
+    {    
         System.out.println( "Verifying " + file );
         Utils.verifyChecksum( file );
     }

Modified: maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/verify.bsh?rev=1763933&r1=1763932&r2=1763933&view=diff
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/verify.bsh (original)
+++ maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/verify.bsh Sat Oct  8 20:06:42 2016
@@ -20,13 +20,11 @@
 import java.io.*;
 import java.util.*;
 
-import org.apache.maven.plugin.install.*;
+import org.apache.maven.plugin.install.Utils;
 
 String[] paths =
 {
     "org/apache/maven/its/install/jsj/test/maven-metadata-local.xml",
-//    "org/apache/maven/its/install/jsj/test/maven-metadata-local.xml.md5",
-//    "org/apache/maven/its/install/jsj/test/maven-metadata-local.xml.sha1",
     "org/apache/maven/its/install/jsj/test/0.1/test-0.1.jar",
     "org/apache/maven/its/install/jsj/test/0.1/test-0.1.jar.md5",
     "org/apache/maven/its/install/jsj/test/0.1/test-0.1.jar.sha1",
@@ -41,6 +39,14 @@ String[] paths =
     "org/apache/maven/its/install/jsj/test/0.1/test-0.1-javadoc.jar.sha1",
 };
 
+Set cksumToCheckPaths = new HashSet( Arrays.asList( new String[]
+{
+    "org/apache/maven/its/install/jsj/test/0.1/test-0.1.jar",
+    "org/apache/maven/its/install/jsj/test/0.1/test-0.1.pom",
+    "org/apache/maven/its/install/jsj/test/0.1/test-0.1-sources.jar",
+    "org/apache/maven/its/install/jsj/test/0.1/test-0.1-javadoc.jar"
+} ) );
+
 for ( String path : paths )
 {
     File file = new File( localRepositoryPath, path );
@@ -49,8 +55,8 @@ for ( String path : paths )
     {
         throw new FileNotFoundException( "Missing: " + file.getAbsolutePath() );
     }
-    if ( file.getName().endsWith( ".md5" ) || file.getName().endsWith( ".sha1" ) )
-    {
+    if ( cksumToCheckPaths.contains( path ) )
+    {    
         System.out.println( "Verifying " + file );
         Utils.verifyChecksum( file );
     }

Added: maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/invoker.properties?rev=1763933&view=auto
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/invoker.properties (added)
+++ maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/invoker.properties Sat Oct  8 20:06:42 2016
@@ -0,0 +1,18 @@
+# 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.
+
+invoker.goals = org.apache.maven.plugins:maven-install-plugin:${project.version}:install-file

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/invoker.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/invoker.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/pom.xml?rev=1763933&view=auto
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/pom.xml (added)
+++ maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/pom.xml Sat Oct  8 20:06:42 2016
@@ -0,0 +1,46 @@
+<?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.install.lro</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0</version>
+  <packaging>jar</packaging>
+
+  <description>
+    Tests the manual installation into a different local repo than the one configured in the settings
+    (MINSTALL-35), also installing checksums.
+  </description>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-install-plugin</artifactId>
+        <version>@project.version@</version>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/setup.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/setup.bsh?rev=1763933&view=auto
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/setup.bsh (added)
+++ maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/setup.bsh Sat Oct  8 20:06:42 2016
@@ -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" );
+System.out.println( "Deleting " + file );
+FileUtils.deleteDirectory( file );
+
+return true;

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/setup.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/setup.bsh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/test.jar
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/test.jar?rev=1763933&view=auto
==============================================================================
Binary file - no diff available.

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/test.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/test.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/test.properties?rev=1763933&view=auto
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/test.properties (added)
+++ maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/test.properties Sat Oct  8 20:06:42 2016
@@ -0,0 +1,24 @@
+# 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.
+
+file = test.jar
+groupId = gid
+artifactId = test
+version = 0.1
+packaging = jar
+createChecksum = true
+localRepositoryPath = target/local-repo

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/test.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/test.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/verify.bsh?rev=1763933&view=auto
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/verify.bsh (added)
+++ maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/verify.bsh Sat Oct  8 20:06:42 2016
@@ -0,0 +1,40 @@
+/*
+ * 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.*;
+
+String[] paths =
+{
+    "gid/test/0.1/test-0.1.jar",
+    "gid/test/0.1/test-0.1.jar.md5",
+    "gid/test/0.1/test-0.1.jar.sha1",
+};
+
+for ( String path : paths )
+{
+    File file = new File( new File( basedir, "target/local-repo" ), path );
+    System.out.println( "Checking for existence of " + file );
+    if ( !file.isFile() )
+    {
+        throw new FileNotFoundException( "Existing: " + file.getAbsolutePath() );
+    }
+}
+
+return true;

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/verify.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/local-repo-override-with-checksum/verify.bsh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/plugins/trunk/maven-install-plugin/src/it/pom-checksum/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/pom-checksum/verify.bsh?rev=1763933&r1=1763932&r2=1763933&view=diff
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/pom-checksum/verify.bsh (original)
+++ maven/plugins/trunk/maven-install-plugin/src/it/pom-checksum/verify.bsh Sat Oct  8 20:06:42 2016
@@ -20,7 +20,7 @@
 import java.io.*;
 import java.util.*;
 
-import org.apache.maven.plugin.install.*;
+import org.apache.maven.plugin.install.Utils;
 
 String[] paths =
 {
@@ -28,13 +28,14 @@ String[] paths =
     "org/apache/maven/its/install/pc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.pom.md5",
     "org/apache/maven/its/install/pc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.pom.sha1",
     "org/apache/maven/its/install/pc/test/1.0-SNAPSHOT/maven-metadata-local.xml",
-//    "org/apache/maven/its/install/pc/test/1.0-SNAPSHOT/maven-metadata-local.xml.md5",
-//    "org/apache/maven/its/install/pc/test/1.0-SNAPSHOT/maven-metadata-local.xml.sha1",
     "org/apache/maven/its/install/pc/test/maven-metadata-local.xml",
-//    "org/apache/maven/its/install/pc/test/maven-metadata-local.xml.md5",
-//    "org/apache/maven/its/install/pc/test/maven-metadata-local.xml.sha1",
 };
 
+Set cksumToCheckPaths = new HashSet( Arrays.asList( new String[]
+{
+    "org/apache/maven/its/install/pc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.pom"
+} ) );
+
 for ( String path : paths )
 {
     File file = new File( localRepositoryPath, path );
@@ -43,8 +44,8 @@ for ( String path : paths )
     {
         throw new FileNotFoundException( "Missing: " + file.getAbsolutePath() );
     }
-    if ( file.getName().endsWith( ".md5" ) || file.getName().endsWith( ".sha1" ) )
-    {
+    if ( cksumToCheckPaths.contains( path ) )
+    {    
         System.out.println( "Verifying " + file );
         Utils.verifyChecksum( file );
     }

Modified: maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/AbstractInstallMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/AbstractInstallMojo.java?rev=1763933&r1=1763932&r2=1763933&view=diff
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/AbstractInstallMojo.java (original)
+++ maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/AbstractInstallMojo.java Sat Oct  8 20:06:42 2016
@@ -20,21 +20,15 @@ package org.apache.maven.plugin.install;
  */
 
 import java.io.File;
-import java.io.IOException;
-import java.util.Collection;
 
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.metadata.ArtifactMetadata;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.shared.artifact.install.ArtifactInstaller;
+import org.apache.maven.project.artifact.ProjectArtifactMetadata;
 import org.apache.maven.shared.repository.RepositoryManager;
-import org.apache.maven.shared.utils.io.FileUtils;
 
 /**
  * Common fields for installation mojos.
@@ -46,16 +40,6 @@ public abstract class AbstractInstallMoj
     extends AbstractMojo
 {
 
-    /**
-     */
-    @Component
-    protected ArtifactFactory artifactFactory;
-
-    /**
-     */
-    @Component
-    protected ArtifactInstaller installer;
-    
     @Component
     protected RepositoryManager repositoryManager;
 
@@ -78,8 +62,6 @@ public abstract class AbstractInstallMoj
     @Parameter( property = "updateReleaseInfo", defaultValue = "false" )
     protected boolean updateReleaseInfo;
 
-    protected final DualDigester digester = new DualDigester();
-
     @Parameter( defaultValue = "${session}", required = true, readonly = true )
     protected MavenSession session;
 
@@ -103,116 +85,10 @@ public abstract class AbstractInstallMoj
      * @param metadata The artifact metadata whose local repo path should be determined, must not be <code>null</code>.
      * @return The absolute path to the artifact metadata when installed, never <code>null</code>.
      */
-    protected File getLocalRepoFile( ArtifactMetadata metadata )
+    protected File getLocalRepoFile( ProjectArtifactMetadata metadata )
     {
         String path = localRepository.pathOfLocalRepositoryMetadata( metadata, localRepository );
         return new File( localRepository.getBasedir(), path );
     }
 
-    /**
-     * Installs the checksums for the specified artifact if this has been enabled in the plugin configuration. This
-     * method creates checksums for files that have already been installed to the local repo to account for on-the-fly
-     * generated/updated files. For example, in Maven 2.0.4- the <code>ProjectArtifactMetadata</code> did not install
-     * the original POM file (cf. MNG-2820). While the plugin currently requires Maven 2.0.6, we continue to hash the
-     * installed POM for robustness with regard to future changes like re-introducing some kind of POM filtering.
-     *
-     * @param artifact The artifact for which to create checksums, must not be <code>null</code>.
-     * @param createChecksum {@code true} if checksum should be created, otherwise {@code false}.
-     * @throws MojoExecutionException If the checksums could not be installed.
-     */
-    protected void installChecksums( Artifact artifact, boolean createChecksum )
-        throws MojoExecutionException
-    {
-        if ( !createChecksum )
-        {
-            return;
-        }
-
-        File artifactFile = getLocalRepoFile( artifact );
-        installChecksums( artifactFile );
-    }
-
-    // CHECKSTYLE_OFF: LineLength
-    protected void addMetaDataFilesForArtifact( Artifact artifact, Collection<File> targetMetadataFiles, boolean createChecksum )
-    // CHECKSTYLE_ON: LineLength
-    {
-        if ( !createChecksum )
-        {
-            return;
-        }
-
-        Collection<ArtifactMetadata> metadatas = artifact.getMetadataList();
-        if ( metadatas != null )
-        {
-            for ( ArtifactMetadata metadata : metadatas )
-            {
-                File metadataFile = getLocalRepoFile( metadata );
-                targetMetadataFiles.add( metadataFile );
-            }
-        }
-    }
-
-    /**
-     * Installs the checksums for the specified metadata files.
-     *
-     * @param metadataFiles The collection of metadata files to install checksums for, must not be <code>null</code>.
-     * @throws MojoExecutionException If the checksums could not be installed.
-     */
-    protected void installChecksums( Collection<File> metadataFiles )
-        throws MojoExecutionException
-    {
-        for ( File metadataFile : metadataFiles )
-        {
-            installChecksums( metadataFile );
-        }
-    }
-
-    /**
-     * Installs the checksums for the specified file (if it exists).
-     *
-     * @param installedFile The path to the already installed file in the local repo for which to generate checksums,
-     *                      must not be <code>null</code>.
-     * @throws MojoExecutionException If the checksums could not be installed.
-     */
-    private void installChecksums( File installedFile )
-        throws MojoExecutionException
-    {
-        boolean signatureFile = installedFile.getName().endsWith( ".asc" );
-        if ( installedFile.isFile() && !signatureFile )
-        {
-
-            getLog().debug( "Calculating checksums for " + installedFile );
-            digester.calculate( installedFile );
-            installChecksum( installedFile, ".md5", digester.getMd5() );
-            installChecksum( installedFile, ".sha1", digester.getSha1() );
-        }
-    }
-
-    /**
-     * Installs a checksum for the specified file.
-     *
-     * @param installedFile The base path from which the path to the checksum files is derived by appending the given
-     *                      file extension, must not be <code>null</code>.
-     * @param ext           The file extension (including the leading dot) to use for the checksum file, must not be
-     *                      <code>null</code>.
-     * @param checksum      the checksum to write
-     * @throws MojoExecutionException If the checksum could not be installed.
-     */
-    private void installChecksum( File installedFile, String ext, String checksum )
-        throws MojoExecutionException
-    {
-        File checksumFile = new File( installedFile.getAbsolutePath() + ext );
-        getLog().debug( "Installing checksum to " + checksumFile );
-        try
-        {
-            //noinspection ResultOfMethodCallIgnored
-            checksumFile.getParentFile().mkdirs();
-            FileUtils.fileWrite( checksumFile.getAbsolutePath(), "UTF-8", checksum );
-        }
-        catch ( IOException e )
-        {
-            throw new MojoExecutionException( "Failed to install checksum to " + checksumFile, e );
-        }
-    }
-
 }

Modified: maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java?rev=1763933&r1=1763932&r2=1763933&view=diff
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java (original)
+++ maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java Sat Oct  8 20:06:42 2016
@@ -28,17 +28,13 @@ import java.io.OutputStream;
 import java.io.Reader;
 import java.io.Writer;
 import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
 import java.util.Enumeration;
-import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 import java.util.regex.Pattern;
 
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.metadata.ArtifactMetadata;
 import org.apache.maven.model.InputLocation;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.Parent;
@@ -46,6 +42,8 @@ import org.apache.maven.model.building.D
 import org.apache.maven.model.building.ModelBuildingRequest;
 import org.apache.maven.model.building.ModelProblem.Severity;
 import org.apache.maven.model.building.ModelProblemCollector;
+import org.apache.maven.model.building.ModelSource;
+import org.apache.maven.model.building.StringModelSource;
 import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
 import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
 import org.apache.maven.model.validation.ModelValidator;
@@ -54,9 +52,15 @@ import org.apache.maven.plugin.MojoFailu
 import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.DefaultProjectBuildingRequest;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectHelper;
+import org.apache.maven.project.ProjectBuilder;
+import org.apache.maven.project.ProjectBuildingException;
 import org.apache.maven.project.ProjectBuildingRequest;
 import org.apache.maven.project.artifact.ProjectArtifactMetadata;
-import org.apache.maven.shared.artifact.install.ArtifactInstallerException;
+import org.apache.maven.shared.project.install.ProjectInstaller;
+import org.apache.maven.shared.project.install.ProjectInstallerRequest;
 import org.apache.maven.shared.utils.ReaderFactory;
 import org.apache.maven.shared.utils.WriterFactory;
 import org.apache.maven.shared.utils.io.IOUtil;
@@ -78,28 +82,28 @@ public class InstallFileMojo
      * {@code pom.xml} in jar if available.
      */
     @Parameter( property = "groupId" )
-    protected String groupId;
+    private String groupId;
 
     /**
      * ArtifactId of the artifact to be installed. Retrieved from POM file if one is specified or extracted from
      * {@code pom.xml} in jar if available.
      */
     @Parameter( property = "artifactId" )
-    protected String artifactId;
+    private String artifactId;
 
     /**
      * Version of the artifact to be installed. Retrieved from POM file if one is specified or extracted from
      * {@code pom.xml} in jar if available.
      */
     @Parameter( property = "version" )
-    protected String version;
+    private String version;
 
     /**
      * Packaging type of the artifact to be installed. Retrieved from POM file if one is specified or extracted from
      * {@code pom.xml} in jar if available.
      */
     @Parameter( property = "packaging" )
-    protected String packaging;
+    private String packaging;
 
     /**
      * Classifier type of the artifact to be installed. For example, "sources" or "javadoc". Defaults to none which
@@ -108,7 +112,7 @@ public class InstallFileMojo
      * @since 2.2
      */
     @Parameter( property = "classifier" )
-    protected String classifier;
+    private String classifier;
 
     /**
      * The file to be installed in the local repository.
@@ -166,6 +170,24 @@ public class InstallFileMojo
     private ModelValidator modelValidator;
     
     /**
+     * Used for attaching the artifacts to install to the project.
+     */
+    @Component
+    private MavenProjectHelper projectHelper;
+
+    /**
+     * Used for creating the project to which the artifacts to install will be attached.
+     */
+    @Component
+    private ProjectBuilder projectBuilder;
+    
+    /**
+     * Used to install the project created.
+     */
+    @Component
+    private ProjectInstaller installer;
+    
+    /**
      * @see org.apache.maven.plugin.Mojo#execute()
      */
     public void execute()
@@ -202,34 +224,57 @@ public class InstallFileMojo
 
         validateArtifactInformation();
         
-        Artifact artifact =
-            artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, packaging, classifier );
-
+        MavenProject project = createMavenProject();
+        Artifact artifact = project.getArtifact();
+        
         if ( file.equals( getLocalRepoFile( artifact ) ) )
         {
             throw new MojoFailureException( "Cannot install artifact. "
                 + "Artifact is already in the local repository.\n\nFile in question is: " + file + "\n" );
         }
-        artifact.setFile( file );
-
-        File generatedPomFile = null;
+        
+        if ( classifier == null )
+        {
+            artifact.setFile( file );
+            if ( "pom".equals( packaging ) )
+            {
+                project.setFile( file );
+            }
+        }
+        else
+        {
+            projectHelper.attachArtifact( project, packaging, classifier, file );
+        }
 
         if ( !"pom".equals( packaging ) )
         {
             if ( pomFile != null )
             {
-                ArtifactMetadata pomMetadata = new ProjectArtifactMetadata( artifact, pomFile );
-                artifact.addMetadata( pomMetadata );
+                if ( classifier == null )
+                {
+                    artifact.addMetadata( new ProjectArtifactMetadata( artifact, pomFile ) );
+                }
+                else
+                {
+                    project.setFile( pomFile );
+                }
             }
             else
             {
-                generatedPomFile = generatePomFile();
-                ArtifactMetadata pomMetadata = new ProjectArtifactMetadata( artifact, generatedPomFile );
+                File generatedPomFile = generatePomFile();
+                ProjectArtifactMetadata pomMetadata = new ProjectArtifactMetadata( artifact, generatedPomFile );
                 if ( Boolean.TRUE.equals( generatePom )
                     || ( generatePom == null && !getLocalRepoFile( pomMetadata ).exists() ) )
                 {
                     getLog().debug( "Installing generated POM" );
-                    artifact.addMetadata( pomMetadata );
+                    if ( classifier == null )
+                    {
+                        artifact.addMetadata( pomMetadata );
+                    }
+                    else
+                    {
+                        project.setFile( generatedPomFile );
+                    }
                 }
                 else if ( generatePom == null )
                 {
@@ -238,74 +283,57 @@ public class InstallFileMojo
             }
         }
 
-        if ( updateReleaseInfo )
+        if ( sources != null )
         {
-            artifact.setRelease( true );
+            projectHelper.attachArtifact( project, "jar", "sources", sources );
         }
 
-        Collection<File> metadataFiles = new LinkedHashSet<File>();
-
-        // TODO: maybe not strictly correct, while we should enforce that packaging has a type handler of the same id,
-        // we don't
-        try
+        if ( javadoc != null )
         {
-//            installer.install( file, artifact, localRepository );
-            installer.install( buildingRequest, Collections.singletonList( artifact ) );
-            installChecksums( artifact, createChecksum );
-            addMetaDataFilesForArtifact( artifact, metadataFiles, createChecksum );
-
+            projectHelper.attachArtifact( project, "jar", "javadoc", javadoc );
         }
-        catch ( ArtifactInstallerException e )
+        
+        try
         {
-            throw new MojoExecutionException( "Error installing artifact '" + artifact.getDependencyConflictId()
-                + "': " + e.getMessage(), e );
+            // CHECKSTYLE_OFF: LineLength
+            ProjectInstallerRequest projectInstallerRequest =
+                new ProjectInstallerRequest().setProject( project ).setCreateChecksum( createChecksum ).setUpdateReleaseInfo( updateReleaseInfo );
+            // CHECKSTYLE_ON: LineLength
+
+            installer.install( buildingRequest, projectInstallerRequest, localRepository );
         }
-        finally
+        catch ( Exception e )
         {
-            if ( generatedPomFile != null )
-            {
-                // noinspection ResultOfMethodCallIgnored
-                generatedPomFile.delete();
-            }
+            throw new MojoExecutionException( e.getMessage(), e );
         }
-
-        if ( sources != null )
+    }
+    
+    /**
+     * Creates a Maven project in-memory from the user-supplied groupId, artifactId and version. When a classifier is
+     * supplied, the packaging must be POM because the project with only have attachments. This project serves as basis
+     * to attach the artifacts to install to.
+     * 
+     * @return The created Maven project, never <code>null</code>.
+     * @throws MojoFailureException When building the project failed.
+     */
+    private MavenProject createMavenProject()
+        throws MojoFailureException
+    {
+        ModelSource modelSource =
+            new StringModelSource( "<project>" + "<modelVersion>4.0.0</modelVersion>" + "<groupId>" + groupId
+                + "</groupId>" + "<artifactId>" + artifactId + "</artifactId>" + "<version>" + version + "</version>"
+                + "<packaging>" + ( classifier == null ? packaging : "pom" ) + "</packaging>" + "</project>" );
+        DefaultProjectBuildingRequest buildingRequest =
+            new DefaultProjectBuildingRequest( session.getProjectBuildingRequest() );
+        buildingRequest.setProcessPlugins( false );
+        try
         {
-            artifact = artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, "jar", "sources" );
-            artifact.setFile( sources );
-            try
-            {
-//                installer.install( sources, artifact, localRepository );
-                installer.install( buildingRequest, Collections.singletonList( artifact ) );
-                installChecksums( artifact, createChecksum );
-                addMetaDataFilesForArtifact( artifact, metadataFiles, createChecksum );
-
-            }
-            catch ( ArtifactInstallerException e )
-            {
-                throw new MojoExecutionException( "Error installing sources " + sources + ": " + e.getMessage(), e );
-            }
+            return projectBuilder.build( modelSource, buildingRequest ).getProject();
         }
-
-        if ( javadoc != null )
+        catch ( ProjectBuildingException e )
         {
-            artifact = artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, "jar", "javadoc" );
-            artifact.setFile( javadoc );
-            try
-            {
-//                installer.install( javadoc, artifact, localRepository );
-                installer.install( buildingRequest, Collections.singletonList( artifact ) );                
-                installChecksums( artifact, createChecksum );
-                addMetaDataFilesForArtifact( artifact, metadataFiles, createChecksum );
-
-            }
-            catch ( ArtifactInstallerException e )
-            {
-                throw new MojoExecutionException( "Error installing API docs " + javadoc + ": " + e.getMessage(), e );
-            }
+            throw new MojoFailureException( e.getMessage(), e );
         }
-
-        installChecksums( metadataFiles );
     }
 
     private void readingPomFromJarFile()

Modified: maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallFileMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallFileMojoTest.java?rev=1763933&r1=1763932&r2=1763933&view=diff
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallFileMojoTest.java (original)
+++ maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallFileMojoTest.java Sat Oct  8 20:06:42 2016
@@ -21,6 +21,7 @@ package org.apache.maven.plugin.install;
 
 import java.io.File;
 import java.io.Reader;
+import java.util.Map;
 
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Model;
@@ -32,6 +33,7 @@ import org.apache.maven.shared.utils.Rea
 import org.apache.maven.shared.utils.io.FileUtils;
 import org.apache.maven.shared.utils.io.IOUtil;
 import org.sonatype.aether.impl.internal.EnhancedLocalRepositoryManager;
+import org.sonatype.aether.util.ChecksumUtils;
 import org.sonatype.aether.util.DefaultRepositorySystemSession;
 
 import static org.mockito.Mockito.mock;
@@ -45,8 +47,6 @@ public class InstallFileMojoTest
 {
     private String groupId;
 
-    private String legacyGroupId;
-
     private String artifactId;
 
     private String version;
@@ -272,27 +272,20 @@ public class InstallFileMojoTest
 
         mojo.execute();
 
-        //get the actual checksum of the artifact
-        mojo.digester.calculate( file );
-        String actualMd5Sum = mojo.digester.getMd5();
-        String actualSha1Sum = mojo.digester.getSha1();
-
         String localPath = getBasedir() + "/" + LOCAL_REPO + groupId + "/" + artifactId + "/" + version + "/" +
-            artifactId + "-" + version;
-
+                        artifactId + "-" + version;
+        
         File installedArtifact = new File( localPath + "." + "jar" );
-
-        File md5 = new File( localPath + ".jar.md5" );
-        File sha1 = new File( localPath + ".jar.sha1" );
-
-        assertTrue( md5.exists() );
-        assertTrue( sha1.exists() );
-
-        String generatedMd5 = FileUtils.fileRead( md5, "UTF-8" );
-        String generatedSha1 = FileUtils.fileRead( sha1, "UTF-8" );
-
-        assertEquals( actualMd5Sum, generatedMd5 );
-        assertEquals( actualSha1Sum, generatedSha1 );
+        
+        //get the actual checksum of the artifact
+        Map<String, Object> csums = ChecksumUtils.calc( file, Utils.CHECKSUM_ALGORITHMS );
+        for (Map.Entry<String, Object> csum : csums.entrySet()) {
+            Object actualSum = csum.getValue();
+            File sum = new File( localPath + ".jar." + csum.getKey().toLowerCase().replace( "-", "" ) );
+            assertTrue( sum.exists() );
+            String generatedSum = FileUtils.fileRead( sum, "UTF-8" );
+            assertEquals( actualSum, generatedSum );
+        }
 
         assertTrue( installedArtifact.exists() );
         
@@ -304,8 +297,6 @@ public class InstallFileMojoTest
     {
         this.groupId = dotToSlashReplacer( (String) getVariableValueFromObject( obj, "groupId" ) );
 
-        this.legacyGroupId = (String) getVariableValueFromObject( obj, "groupId" );
-
         this.artifactId = (String) getVariableValueFromObject( obj, "artifactId" );
 
         this.version = (String) getVariableValueFromObject( obj, "version" );

Modified: maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallMojoTest.java?rev=1763933&r1=1763932&r2=1763933&view=diff
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallMojoTest.java (original)
+++ maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallMojoTest.java Sat Oct  8 20:06:42 2016
@@ -25,6 +25,7 @@ import static org.mockito.Mockito.when;
 import java.io.File;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.metadata.ArtifactMetadata;
@@ -39,6 +40,7 @@ import org.apache.maven.project.MavenPro
 import org.apache.maven.project.ProjectBuildingRequest;
 import org.apache.maven.shared.utils.io.FileUtils;
 import org.sonatype.aether.impl.internal.EnhancedLocalRepositoryManager;
+import org.sonatype.aether.util.ChecksumUtils;
 import org.sonatype.aether.util.DefaultRepositorySystemSession;
 
 /**
@@ -293,45 +295,32 @@ public class InstallMojoTest
 
         assertTrue( pom.exists() );
 
-        //get the actual checksum of the pom
-        mojo.digester.calculate( pom );
-        String actualPomMd5Sum = mojo.digester.getMd5();
-        String actualPomSha1Sum = mojo.digester.getSha1();
-
-        //get the actual checksum of the artifact
-        mojo.digester.calculate( file );
-        String actualMd5Sum = mojo.digester.getMd5();
-        String actualSha1Sum = mojo.digester.getSha1();
-
         String groupId = dotToSlashReplacer( artifact.getGroupId() );
-
         String packaging = project.getPackaging();
-
         String localPath = getBasedir() + "/" + LOCAL_REPO + groupId + "/" + artifact.getArtifactId() + "/" +
-            artifact.getVersion() + "/" + artifact.getArtifactId() + "-" + artifact.getVersion();
-
-        File installedArtifact = new File( localPath + "." + packaging );
-
-        File pomMd5 = new File( localPath + ".pom.md5" );
-        File pomSha1 = new File( localPath + ".pom.sha1" );
+                        artifact.getVersion() + "/" + artifact.getArtifactId() + "-" + artifact.getVersion();
+        
+        //get the actual checksum of the pom
+        Map<String, Object> csums = ChecksumUtils.calc( pom, Utils.CHECKSUM_ALGORITHMS );
+        for (Map.Entry<String, Object> csum : csums.entrySet()) {
+            Object actualPomSum = csum.getValue();
+            File pomSum = new File( localPath + ".pom." + csum.getKey().toLowerCase().replace( "-", "" ) );
+            assertTrue( pomSum.exists() );
+            String generatedPomSum = FileUtils.fileRead( pomSum, "UTF-8" );
+            assertEquals( actualPomSum, generatedPomSum );
+        }
 
-        File md5 = new File( localPath + "." + packaging + ".md5" );
-        File sha1 = new File( localPath + "." + packaging + ".sha1" );
+        //get the actual checksum of the artifact
+        csums = ChecksumUtils.calc( file, Utils.CHECKSUM_ALGORITHMS );
+        for (Map.Entry<String, Object> csum : csums.entrySet()) {
+            Object actualSum = csum.getValue();
+            File sum = new File( localPath + "." + packaging + "." + csum.getKey().toLowerCase().replace( "-", "" ) );
+            assertTrue( sum.exists() );
+            String generatedSum = FileUtils.fileRead( sum, "UTF-8" );
+            assertEquals( actualSum, generatedSum );
+        }
 
-        assertTrue( pomMd5.exists() );
-        assertTrue( pomSha1.exists() );
-        assertTrue( md5.exists() );
-        assertTrue( sha1.exists() );
-
-        String generatedMd5 = FileUtils.fileRead( md5, "UTF-8" );
-        String generatedSha1 = FileUtils.fileRead( sha1, "UTF-8" );
-        String generatedPomMd5 = FileUtils.fileRead( pomMd5, "UTF-8" );
-        String generatedPomSha1 = FileUtils.fileRead( pomSha1, "UTF-8" );
-
-        assertEquals( actualMd5Sum, generatedMd5 );
-        assertEquals( actualSha1Sum, generatedSha1 );
-        assertEquals( actualPomMd5Sum, generatedPomMd5 );
-        assertEquals( actualPomSha1Sum, generatedPomSha1 );
+        File installedArtifact = new File( localPath + "." + packaging );
 
         assertTrue( installedArtifact.exists() );
         

Modified: maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/Utils.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/Utils.java?rev=1763933&r1=1763932&r2=1763933&view=diff
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/Utils.java (original)
+++ maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/Utils.java Sat Oct  8 20:06:42 2016
@@ -21,9 +21,12 @@ package org.apache.maven.plugin.install;
 
 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.codehaus.plexus.util.FileUtils;
+import org.sonatype.aether.util.ChecksumUtils;
 
 /**
  * A utility class to assist testing.
@@ -31,37 +34,31 @@ import org.codehaus.plexus.util.FileUtil
  * @author Benjamin Bentmann
  * @version $Id$
  */
-@SuppressWarnings( "UnusedDeclaration" )
 public class Utils
 {
 
+    public static final List<String> CHECKSUM_ALGORITHMS = Arrays.asList( "MD5", "SHA-1" );
+
     /**
-     * Verifies a checksum file in the local repo.
+     * Verifies the checksum files in the local repo for the given file.
      *
-     * @param checksumFile The checksum file to verify, must not be <code>null</code>.
+     * @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 checksumFile )
+    public static void verifyChecksum( File file )
         throws MojoExecutionException, IOException
     {
-        File dataFile;
-        SimpleDigester digester;
-        if ( checksumFile.getName().endsWith( ".md5" ) )
-        {
-            digester = SimpleDigester.md5();
-            dataFile = new File( checksumFile.getPath().substring( 0, checksumFile.getPath().length() - 4 ) );
-        }
-        else if ( checksumFile.getName().endsWith( ".sha1" ) )
+        Map<String, Object> checksums = ChecksumUtils.calc( file, CHECKSUM_ALGORITHMS );
+        for ( Map.Entry<String, Object> entry : checksums.entrySet() )
         {
-            digester = SimpleDigester.sha1();
-            dataFile = new File( checksumFile.getPath().substring( 0, checksumFile.getPath().length() - 5 ) );
+            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 );
+            }
         }
-        else
-        {
-            throw new IllegalArgumentException( "Unsupported checksum file: " + checksumFile );
-        }
-
-        String expected = FileUtils.fileRead( checksumFile, "UTF-8" );
-        digester.verify( dataFile, expected );
     }
 
 }