Author: rfscholte
Date: Sun Oct 11 18:39:20 2015
New Revision: 1708008

URL: http://svn.apache.org/viewvc?rev=1708008&view=rev
Log:
Merge with 3.0-branch

Added:
    
maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/testingharness/
      - copied from r1678503, 
maven/plugins/branches/m-install-p-3.0/src/test/java/org/apache/maven/plugin/install/testingharness/
    maven/plugins/trunk/maven-install-plugin/src/test/resources/META-INF/
      - copied from r1678503, 
maven/plugins/branches/m-install-p-3.0/src/test/resources/META-INF/
Removed:
    
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/install-file-layout-test/
Modified:
    maven/plugins/trunk/maven-install-plugin/   (props changed)
    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/main/java/org/apache/maven/plugin/install/InstallMojo.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/stubs/InstallArtifactStub.java
    
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/basic-install-checksum/plugin-config.xml
    
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/basic-install-test-packaging-pom/plugin-config.xml
    
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/basic-install-test-with-attached-artifacts/plugin-config.xml
    
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/basic-install-test/plugin-config.xml
    
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/configured-install-test/plugin-config.xml

Propchange: maven/plugins/trunk/maven-install-plugin/
------------------------------------------------------------------------------
    svn:mergeinfo = /maven/plugins/branches/m-install-p-3.0:1666646-1678503

Modified: maven/plugins/trunk/maven-install-plugin/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/pom.xml?rev=1708008&r1=1708007&r2=1708008&view=diff
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-install-plugin/pom.xml Sun Oct 11 18:39:20 2015
@@ -30,7 +30,7 @@ under the License.
   </parent>
 
   <artifactId>maven-install-plugin</artifactId>
-  <version>2.5.3-SNAPSHOT</version>
+  <version>3.0-SNAPSHOT</version>
   <packaging>maven-plugin</packaging>
 
   <name>Apache Maven Install Plugin</name>
@@ -59,7 +59,9 @@ under the License.
   </distributionManagement>
 
   <properties>
-    <mavenVersion>2.2.1</mavenVersion>
+    <mavenVersion>3.0</mavenVersion>
+    <maven.compiler.source>1.6</maven.compiler.source>
+    <maven.compiler.target>1.6</maven.compiler.target>
   </properties>
 
   <dependencies>
@@ -70,25 +72,21 @@ under the License.
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
-      <artifactId>maven-project</artifactId>
-      <version>${mavenVersion}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
       <artifactId>maven-model</artifactId>
       <version>${mavenVersion}</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
-      <artifactId>maven-artifact-manager</artifactId>
-      <version>${mavenVersion}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
       <artifactId>maven-artifact</artifactId>
       <version>${mavenVersion}</version>
     </dependency>
 
+    <dependency>
+      <groupId>org.apache.maven.shared</groupId>
+      <artifactId>maven-artifact-transfer</artifactId>
+      <version>3.0-SNAPSHOT</version>
+    </dependency>
+    
     <!-- dependencies to annotations -->
     <dependency>
       <groupId>org.apache.maven.plugin-tools</groupId>
@@ -97,11 +95,36 @@ under the License.
     </dependency>
 
     <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.11</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>org.apache.maven.plugin-testing</groupId>
       <artifactId>maven-plugin-testing-harness</artifactId>
-      <version>1.3</version>
+      <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>
+      <artifactId>maven-compat</artifactId>
+      <version>${mavenVersion}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-core</artifactId>
+      <version>1.9.5</version>
       <scope>test</scope>
     </dependency>
+    
     <dependency>
       <groupId>commons-codec</groupId>
       <artifactId>commons-codec</artifactId>
@@ -138,8 +161,8 @@ under the License.
             <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-invoker-plugin</artifactId>
+              <version>1.10</version>
               <configuration>
-                <debug>true</debug>
                 
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                 <cloneClean>true</cloneClean>
                 <pomIncludes>

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=1708008&r1=1708007&r2=1708008&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 
Sun Oct 11 18:39:20 2015
@@ -34,11 +34,11 @@ 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/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",
+//    "org/apache/maven/its/install/ajc/test/maven-metadata-local.xml.md5",
+//    "org/apache/maven/its/install/ajc/test/maven-metadata-local.xml.sha1",
 };
 
 for ( String path : paths )

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=1708008&r1=1708007&r2=1708008&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 
Sun Oct 11 18:39:20 2015
@@ -25,8 +25,8 @@ import org.apache.maven.plugin.install.*
 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/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",

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=1708008&r1=1708007&r2=1708008&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 
Sun Oct 11 18:39:20 2015
@@ -25,8 +25,8 @@ import org.apache.maven.plugin.install.*
 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/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",

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=1708008&r1=1708007&r2=1708008&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 Sun 
Oct 11 18:39:20 2015
@@ -28,11 +28,11 @@ 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/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",
+//    "org/apache/maven/its/install/pc/test/maven-metadata-local.xml.md5",
+//    "org/apache/maven/its/install/pc/test/maven-metadata-local.xml.sha1",
 };
 
 for ( String path : paths )

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=1708008&r1=1708007&r2=1708008&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
 Sun Oct 11 18:39:20 2015
@@ -25,13 +25,15 @@ import java.util.Collection;
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.installer.ArtifactInstaller;
 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.shared.artifact.repository.RepositoryManager;
 import org.apache.maven.shared.utils.io.FileUtils;
 
 /**
@@ -53,6 +55,9 @@ public abstract class AbstractInstallMoj
      */
     @Component
     protected ArtifactInstaller installer;
+    
+    @Component
+    protected RepositoryManager repositoryManager;
 
     /**
      */
@@ -75,6 +80,9 @@ public abstract class AbstractInstallMoj
 
     protected final DualDigester digester = new DualDigester();
 
+    @Parameter( defaultValue = "${session}", required = true, readonly = true )
+    protected MavenSession session;
+
     /**
      * Gets the path of the specified artifact within the local repository. 
Note that the returned path need not exist
      * (yet).
@@ -84,7 +92,7 @@ public abstract class AbstractInstallMoj
      */
     protected File getLocalRepoFile( Artifact artifact )
     {
-        String path = localRepository.pathOf( artifact );
+        String path = repositoryManager.getPathForLocalArtifact( 
session.getProjectBuildingRequest(), artifact );
         return new File( localRepository.getBasedir(), path );
     }
 

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=1708008&r1=1708007&r2=1708008&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
 Sun Oct 11 18:39:20 2015
@@ -27,32 +27,36 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.Reader;
 import java.io.Writer;
-import java.net.MalformedURLException;
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Enumeration;
 import java.util.LinkedHashSet;
-import java.util.Map;
+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.installer.ArtifactInstallationException;
 import org.apache.maven.artifact.metadata.ArtifactMetadata;
-import org.apache.maven.artifact.repository.DefaultArtifactRepository;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+import org.apache.maven.model.InputLocation;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.Parent;
+import org.apache.maven.model.building.DefaultModelBuildingRequest;
+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.io.xpp3.MavenXpp3Reader;
 import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
+import org.apache.maven.model.validation.ModelValidator;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 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.ProjectBuildingRequest;
 import org.apache.maven.project.artifact.ProjectArtifactMetadata;
-import org.apache.maven.project.validation.ModelValidationResult;
-import org.apache.maven.project.validation.ModelValidator;
+import org.apache.maven.shared.artifact.install.ArtifactInstallerException;
 import org.apache.maven.shared.utils.ReaderFactory;
 import org.apache.maven.shared.utils.WriterFactory;
 import org.apache.maven.shared.utils.io.IOUtil;
@@ -147,21 +151,6 @@ public class InstallFileMojo
     private Boolean generatePom;
 
     /**
-     * The type of remote repository layout to install to. Try 
<code>legacy</code> for a Maven 1.x-style repository
-     * layout.
-     * 
-     * @since 2.2
-     */
-    @Parameter( property = "repositoryLayout", defaultValue = "default", 
required = true )
-    private String repositoryLayout;
-
-    /**
-     * Map that contains the repository layouts.
-     */
-    @Component( role = ArtifactRepositoryLayout.class )
-    private Map<String, ArtifactRepositoryLayout> repositoryLayouts;
-
-    /**
      * The path for a specific local repository directory. If not specified 
the local repository path configured in the
      * Maven settings will be used.
      * 
@@ -171,11 +160,11 @@ public class InstallFileMojo
     private File localRepositoryPath;
 
     /**
-     * The component used to validate the user-supplied artifact coordinates.
-     */
+    * The component used to validate the user-supplied artifact coordinates.
+    */
     @Component
     private ModelValidator modelValidator;
-
+    
     /**
      * @see org.apache.maven.plugin.Mojo#execute()
      */
@@ -190,25 +179,16 @@ public class InstallFileMojo
             throw new MojoFailureException( message );
         }
 
+        ProjectBuildingRequest buildingRequest = 
session.getProjectBuildingRequest();
+        
         // 
----------------------------------------------------------------------
         // Override the default localRepository variable
         // 
----------------------------------------------------------------------
         if ( localRepositoryPath != null )
         {
-            try
-            {
-                ArtifactRepositoryLayout layout = repositoryLayouts.get( 
repositoryLayout );
-                getLog().debug( "Layout: " + layout.getClass() );
-
-                // noinspection deprecation
-                localRepository =
-                    new DefaultArtifactRepository( localRepository.getId(), 
localRepositoryPath.toURL().toString(),
-                                                   layout );
-            }
-            catch ( MalformedURLException e )
-            {
-                throw new MojoExecutionException( "MalformedURLException: " + 
e.getMessage(), e );
-            }
+            buildingRequest = repositoryManager.setLocalRepositoryBasedir( 
buildingRequest, localRepositoryPath );
+            
+            getLog().debug( "localRepoPath: " + 
repositoryManager.getLocalRepositoryBasedir( buildingRequest ) );
         }
 
         if ( pomFile != null )
@@ -303,6 +283,7 @@ public class InstallFileMojo
             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;
 
@@ -341,12 +322,13 @@ public class InstallFileMojo
         // we don't
         try
         {
-            installer.install( file, artifact, localRepository );
+//            installer.install( file, artifact, localRepository );
+            installer.install( buildingRequest, Collections.singletonList( 
artifact ) );
             installChecksums( artifact, createChecksum );
             addMetaDataFilesForArtifact( artifact, metadataFiles, 
createChecksum );
 
         }
-        catch ( ArtifactInstallationException e )
+        catch ( ArtifactInstallerException e )
         {
             throw new MojoExecutionException( "Error installing artifact '" + 
artifact.getDependencyConflictId()
                 + "': " + e.getMessage(), e );
@@ -363,14 +345,16 @@ public class InstallFileMojo
         if ( sources != null )
         {
             artifact = artifactFactory.createArtifactWithClassifier( groupId, 
artifactId, version, "jar", "sources" );
+            artifact.setFile( sources );
             try
             {
-                installer.install( sources, artifact, localRepository );
+//                installer.install( sources, artifact, localRepository );
+                installer.install( buildingRequest, Collections.singletonList( 
artifact ) );
                 installChecksums( artifact, createChecksum );
                 addMetaDataFilesForArtifact( artifact, metadataFiles, 
createChecksum );
 
             }
-            catch ( ArtifactInstallationException e )
+            catch ( ArtifactInstallerException e )
             {
                 throw new MojoExecutionException( "Error installing sources " 
+ sources + ": " + e.getMessage(), e );
             }
@@ -379,14 +363,16 @@ public class InstallFileMojo
         if ( javadoc != null )
         {
             artifact = artifactFactory.createArtifactWithClassifier( groupId, 
artifactId, version, "jar", "javadoc" );
+            artifact.setFile( javadoc );
             try
             {
-                installer.install( javadoc, artifact, localRepository );
+//                installer.install( javadoc, artifact, localRepository );
+                installer.install( buildingRequest, Collections.singletonList( 
artifact ) );                
                 installChecksums( artifact, createChecksum );
                 addMetaDataFilesForArtifact( artifact, metadataFiles, 
createChecksum );
 
             }
-            catch ( ArtifactInstallationException e )
+            catch ( ArtifactInstallerException e )
             {
                 throw new MojoExecutionException( "Error installing API docs " 
+ javadoc + ": " + e.getMessage(), e );
             }
@@ -474,15 +460,19 @@ public class InstallFileMojo
     {
         Model model = generateModel();
 
-        ModelValidationResult result = modelValidator.validate( model );
+        ModelBuildingRequest buildingRequest = new 
DefaultModelBuildingRequest();
+        
+        InstallModelProblemCollector problemCollector = new 
InstallModelProblemCollector();
+        
+        modelValidator.validateEffectiveModel( model, buildingRequest , 
problemCollector );
 
-        if ( result.getMessageCount() > 0 )
+        if ( problemCollector.getMessageCount() > 0 )
         {
             throw new MojoExecutionException( "The artifact information is 
incomplete or not valid:\n"
-                + result.render( "  " ) );
+                + problemCollector.render( "  " ) );
         }
     }
-
+    
     /**
      * Generates a minimal model from the user-supplied artifact information.
      * 
@@ -553,4 +543,41 @@ public class InstallFileMojo
         this.localRepositoryPath = theLocalRepositoryPath;
     }
 
+    
+    private static class InstallModelProblemCollector implements 
ModelProblemCollector
+    {
+        /** */
+        private static final String NEWLINE = System.getProperty( 
"line.separator" );
+
+        /** */
+        private List<String> messages = new ArrayList<String>();
+        
+        @Override
+        public void add( Severity severity, String message, InputLocation 
location, Exception cause )
+        {
+            messages.add( message );
+        }
+
+        public int getMessageCount()
+        {
+            return messages.size();
+        }
+
+        public String render( String indentation )
+        {
+            if ( messages.size() == 0 )
+            {
+                return indentation + "There were no validation errors.";
+            }
+
+            StringBuilder message = new StringBuilder();
+
+            for ( int i = 0; i < messages.size(); i++ )
+            {
+                message.append( indentation + "[" + i + "]  " + messages.get( 
i ).toString() + NEWLINE );
+            }
+
+            return message.toString();
+        }
+    };
 }

Modified: 
maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java?rev=1708008&r1=1708007&r2=1708008&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java
 Sun Oct 11 18:39:20 2015
@@ -28,14 +28,14 @@ import java.util.List;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.installer.ArtifactInstallationException;
-import org.apache.maven.artifact.metadata.ArtifactMetadata;
 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.project.artifact.ProjectArtifact;
 import org.apache.maven.project.artifact.ProjectArtifactMetadata;
+import org.apache.maven.shared.artifact.install.ArtifactInstallerException;
 
 /**
  * Installs the project's main artifact, and any other artifacts attached by 
other plugins in the lifecycle, to the
@@ -65,7 +65,7 @@ public class InstallMojo
 
     @Parameter( defaultValue = "${reactorProjects}", required = true, readonly 
= true )
     private List<MavenProject> reactorProjects;
-
+    
     /**
      * Whether every project should be installed during its own install-phase 
or at the end of the multimodule build. If
      * set to {@code true} and the build fails, none of the reactor projects 
is installed.
@@ -77,18 +77,6 @@ public class InstallMojo
     private boolean installAtEnd;
 
     /**
-     * @deprecated either use project.getPackaging() or 
reactorProjects.get(i).getPackaging()
-     */
-    @Parameter( defaultValue = "${project.packaging}", required = true, 
readonly = true )
-    protected String packaging;
-
-    /**
-     * @deprecated either use project.getFile() or 
reactorProjects.get(i).getFile()
-     */
-    @Parameter( defaultValue = "${project.file}", required = true, readonly = 
true )
-    private File pomFile;
-
-    /**
      * Set this to <code>true</code> to bypass artifact installation. Use this 
for artifacts that does not need to be
      * installed in the local repository.
      * 
@@ -97,18 +85,6 @@ public class InstallMojo
     @Parameter( property = "maven.install.skip", defaultValue = "false" )
     private boolean skip;
 
-    /**
-     * @deprecated either use project.getArtifact() or 
reactorProjects.get(i).getArtifact()
-     */
-    @Parameter( defaultValue = "${project.artifact}", required = true, 
readonly = true )
-    private Artifact artifact;
-
-    /**
-     * @deprecated either use project.getAttachedArtifacts() or 
reactorProjects.get(i).getAttachedArtifacts()
-     */
-    @Parameter( defaultValue = "${project.attachedArtifacts}", required = 
true, readonly = true )
-    private List<Artifact> attachedArtifacts;
-
     public void execute()
         throws MojoExecutionException
     {
@@ -163,13 +139,13 @@ public class InstallMojo
         Artifact artifact = project.getArtifact();
         String packaging = project.getPackaging();
         File pomFile = project.getFile();
-        @SuppressWarnings( "unchecked" )
+
         List<Artifact> attachedArtifacts = project.getAttachedArtifacts();
 
         // TODO: push into transformation
         boolean isPomArtifact = "pom".equals( packaging );
 
-        ArtifactMetadata metadata;
+        ProjectArtifactMetadata metadata;
 
         if ( updateReleaseInfo )
         {
@@ -182,7 +158,9 @@ public class InstallMojo
 
             if ( isPomArtifact )
             {
-                installer.install( pomFile, artifact, localRepository );
+//                installer.install( pomFile, artifact, localRepository );
+                installer.install( session.getProjectBuildingRequest(),
+                                   Collections.<Artifact>singletonList( new 
ProjectArtifact( project ) ) );
                 installChecksums( artifact, createChecksum );
                 addMetaDataFilesForArtifact( artifact, metadataFiles, 
createChecksum );
             }
@@ -197,7 +175,8 @@ public class InstallMojo
                 // but not package). We are designing in a proper solution for 
Maven 2.1
                 if ( file != null && file.isFile() )
                 {
-                    installer.install( file, artifact, localRepository );
+//                    installer.install( file, artifact, localRepository );
+                    installer.install( session.getProjectBuildingRequest(), 
Collections.singletonList( artifact ) );
                     installChecksums( artifact, createChecksum );
                     addMetaDataFilesForArtifact( artifact, metadataFiles, 
createChecksum );
                 }
@@ -214,7 +193,8 @@ public class InstallMojo
                         pomArtifact.setRelease( true );
                     }
 
-                    installer.install( pomFile, pomArtifact, localRepository );
+//                    installer.install( pomFile, pomArtifact, localRepository 
);
+                    installer.install( session.getProjectBuildingRequest(), 
Collections.singletonList( pomArtifact ) );
                     installChecksums( pomArtifact, createChecksum );
                     addMetaDataFilesForArtifact( pomArtifact, metadataFiles, 
createChecksum );
                 }
@@ -229,14 +209,15 @@ public class InstallMojo
 
             for ( Artifact attached : attachedArtifacts )
             {
-                installer.install( attached.getFile(), attached, 
localRepository );
+//                installer.install( attached.getFile(), attached, 
localRepository );
+                installer.install( session.getProjectBuildingRequest(), 
Collections.singletonList( attached ) );
                 installChecksums( attached, createChecksum );
                 addMetaDataFilesForArtifact( attached, metadataFiles, 
createChecksum );
             }
 
             installChecksums( metadataFiles );
         }
-        catch ( ArtifactInstallationException e )
+        catch ( ArtifactInstallerException e )
         {
             throw new MojoExecutionException( e.getMessage(), e );
         }

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=1708008&r1=1708007&r2=1708008&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
 Sun Oct 11 18:39:20 2015
@@ -19,12 +19,25 @@ package org.apache.maven.plugin.install;
  * under the License.
  */
 
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.maven.execution.DefaultMavenExecutionRequest;
+import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.apache.maven.plugin.LegacySupport;
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+import org.apache.maven.project.DefaultProjectBuildingRequest;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.ProjectBuildingRequest;
 import org.apache.maven.shared.utils.ReaderFactory;
 import org.apache.maven.shared.utils.io.FileUtils;
 import org.apache.maven.shared.utils.io.IOUtil;
+import org.sonatype.aether.RepositorySystemSession;
+import org.sonatype.aether.impl.internal.EnhancedLocalRepositoryManager;
+import org.sonatype.aether.util.DefaultRepositorySystemSession;
 
 import java.io.File;
 import java.io.Reader;
@@ -57,6 +70,11 @@ public class InstallFileMojoTest
         super.setUp();
 
         FileUtils.deleteDirectory( new File( getBasedir() + "/" + LOCAL_REPO ) 
);
+        
+//        LegacySupport legacySupport = lookup( LegacySupport.class );
+//        RepositorySystemSession repositorySession = new 
DefaultRepositorySystemSession();
+//        MavenExecutionRequest executionRequest = new 
DefaultMavenExecutionRequest();
+//        legacySupport.setSession( new MavenSession( getContainer(), 
repositorySession, executionRequest, null ) );
     }
 
     public void testInstallFileTestEnvironment()
@@ -65,6 +83,8 @@ public class InstallFileMojoTest
         File testPom = new File( getBasedir(), 
"target/test-classes/unit/install-file-basic-test/plugin-config.xml" );
 
         InstallFileMojo mojo = (InstallFileMojo) lookupMojo( "install-file", 
testPom );
+        
+        setVariableValueToObject( mojo, "session", createMavenSession() );
 
         assertNotNull( mojo );
     }
@@ -77,6 +97,8 @@ public class InstallFileMojoTest
         InstallFileMojo mojo = (InstallFileMojo) lookupMojo( "install-file", 
testPom );
 
         assertNotNull( mojo );
+        
+        setVariableValueToObject( mojo, "session", createMavenSession() );
 
         assignValuesForParameter( mojo );
 
@@ -89,31 +111,8 @@ public class InstallFileMojoTest
             artifactId + "-" + version + "." + packaging );
 
         assertTrue( installedArtifact.exists() );
-    }
-
-    public void testLayoutInstallFile()
-        throws Exception
-    {
-        File testPom = new File( getBasedir(), 
"target/test-classes/unit/install-file-layout-test/plugin-config.xml" );
-
-        InstallFileMojo mojo = (InstallFileMojo) lookupMojo( "install-file", 
testPom );
-
-        assertNotNull( mojo );
-
-        assignValuesForParameter( mojo );
-
-        mojo.setLocalRepositoryPath( new File( getBasedir(), LOCAL_REPO ) );
-
-        mojo.execute();
         
-        File pomFile = (File) getVariableValueFromObject( mojo, "pomFile" );
-        org.codehaus.plexus.util.FileUtils.forceDelete( pomFile );
-
-        File installedArtifact = new File( getBasedir(),
-                                           LOCAL_REPO + legacyGroupId + "/" + 
"jars" + "/" + artifactId + "-" + version
-                                               + "." + packaging );
-
-        assertTrue( installedArtifact.exists() );
+        assertEquals( 5, FileUtils.getFiles( new File( LOCAL_REPO ), null, 
null ).size() );
     }
 
     public void testInstallFileWithClassifier()
@@ -125,6 +124,8 @@ public class InstallFileMojoTest
         InstallFileMojo mojo = (InstallFileMojo) lookupMojo( "install-file", 
testPom );
 
         assertNotNull( mojo );
+        
+        setVariableValueToObject( mojo, "session", createMavenSession() );
 
         assignValuesForParameter( mojo );
 
@@ -139,6 +140,8 @@ public class InstallFileMojoTest
             artifactId + "-" + version + "-" + classifier + "." + packaging );
 
         assertTrue( installedArtifact.exists() );
+        
+        assertEquals( 5, FileUtils.getFiles( new File( LOCAL_REPO ), null, 
null ).size() );
     }
 
     public void testInstallFileWithGeneratePom()
@@ -150,6 +153,8 @@ public class InstallFileMojoTest
         InstallFileMojo mojo = (InstallFileMojo) lookupMojo( "install-file", 
testPom );
 
         assertNotNull( mojo );
+        
+        setVariableValueToObject( mojo, "session", createMavenSession() );
 
         assignValuesForParameter( mojo );
 
@@ -185,6 +190,8 @@ public class InstallFileMojoTest
         assertEquals( artifactId, model.getArtifactId() );
 
         assertEquals( version, model.getVersion() );
+
+        assertEquals( 5, FileUtils.getFiles( new File( LOCAL_REPO ), null, 
null ).size() );
     }
 
     public void testInstallFileWithPomFile()
@@ -196,6 +203,8 @@ public class InstallFileMojoTest
         InstallFileMojo mojo = (InstallFileMojo) lookupMojo( "install-file", 
testPom );
 
         assertNotNull( mojo );
+        
+        setVariableValueToObject( mojo, "session", createMavenSession() );
 
         assignValuesForParameter( mojo );
 
@@ -214,6 +223,8 @@ public class InstallFileMojoTest
             artifactId + "-" + version + "." + "pom" );
 
         assertTrue( installedPom.exists() );
+        
+        assertEquals( 5, FileUtils.getFiles( new File( LOCAL_REPO ), null, 
null ).size() );
     }
 
     public void testInstallFileWithPomAsPackaging()
@@ -225,6 +236,8 @@ public class InstallFileMojoTest
         InstallFileMojo mojo = (InstallFileMojo) lookupMojo( "install-file", 
testPom );
 
         assertNotNull( mojo );
+        
+        setVariableValueToObject( mojo, "session", createMavenSession() );
 
         assignValuesForParameter( mojo );
 
@@ -238,6 +251,8 @@ public class InstallFileMojoTest
             artifactId + "-" + version + "." + "pom" );
 
         assertTrue( installedPom.exists() );
+
+        assertEquals( 4, FileUtils.getFiles( new File( LOCAL_REPO ), null, 
null ).size() );
     }
 
     public void testInstallFileWithChecksum()
@@ -249,6 +264,8 @@ public class InstallFileMojoTest
         InstallFileMojo mojo = (InstallFileMojo) lookupMojo( "install-file", 
testPom );
 
         assertNotNull( mojo );
+        
+        setVariableValueToObject( mojo, "session", createMavenSession() );
 
         assignValuesForParameter( mojo );
 
@@ -281,6 +298,8 @@ public class InstallFileMojoTest
         assertEquals( actualSha1Sum, generatedSha1 );
 
         assertTrue( installedArtifact.exists() );
+        
+        assertEquals( 9, FileUtils.getFiles( new File( LOCAL_REPO ), null, 
null ).size() );
     }
 
     private void assignValuesForParameter( Object obj )
@@ -305,4 +324,15 @@ public class InstallFileMojoTest
     {
         return parameter.replace( '.', '/' );
     }
+    
+    private MavenSession createMavenSession()
+    {
+        MavenSession session = mock( MavenSession.class );
+        DefaultRepositorySystemSession repositorySession  = new 
DefaultRepositorySystemSession();
+        repositorySession.setLocalRepositoryManager( new 
EnhancedLocalRepositoryManager( new File( LOCAL_REPO )     ) );
+        ProjectBuildingRequest buildingRequest = new 
DefaultProjectBuildingRequest();
+        buildingRequest.setRepositorySession( repositorySession );
+        when( session.getProjectBuildingRequest() ).thenReturn( 
buildingRequest );
+        return session;
+    }
 }

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=1708008&r1=1708007&r2=1708008&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
 Sun Oct 11 18:39:20 2015
@@ -19,18 +19,26 @@ package org.apache.maven.plugin.install;
  * under the License.
  */
 
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.File;
+import java.util.Collections;
+import java.util.List;
+
 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.MojoExecutionException;
 import org.apache.maven.plugin.install.stubs.AttachedArtifactStub0;
 import org.apache.maven.plugin.install.stubs.InstallArtifactStub;
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+import org.apache.maven.project.DefaultProjectBuildingRequest;
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.ProjectBuildingRequest;
 import org.apache.maven.shared.utils.io.FileUtils;
-
-import java.io.File;
-import java.util.Collections;
-import java.util.List;
+import org.sonatype.aether.impl.internal.EnhancedLocalRepositoryManager;
+import org.sonatype.aether.util.DefaultRepositorySystemSession;
 
 /**
  * @author <a href="mailto:arami...@apache.org";>Allan Ramirez</a>
@@ -52,6 +60,11 @@ public class InstallMojoTest
         System.out.println( ">>>Cleaning local repo " + getBasedir() + "/" + 
LOCAL_REPO + "..." );
 
         FileUtils.deleteDirectory( new File( getBasedir() + "/" + LOCAL_REPO ) 
);
+        
+//        LegacySupport legacySupport = lookup( LegacySupport.class );
+//        RepositorySystemSession repositorySession = new 
DefaultRepositorySystemSession();
+//        MavenExecutionRequest executionRequest = new 
DefaultMavenExecutionRequest();
+//        legacySupport.setSession( new MavenSession( getContainer(), 
repositorySession, executionRequest, null ) );
     }
 
     public void testInstallTestEnvironment()
@@ -59,7 +72,7 @@ public class InstallMojoTest
     {
         File testPom = new File( getBasedir(), 
"target/test-classes/unit/basic-install-test/plugin-config.xml" );
 
-        InstallMojo mojo = (InstallMojo) lookupMojo( "install", testPom );
+        AbstractInstallMojo mojo = (AbstractInstallMojo) lookupMojo( 
"install", testPom );
 
         assertNotNull( mojo );
     }
@@ -69,7 +82,7 @@ public class InstallMojoTest
     {
         File testPom = new File( getBasedir(), 
"target/test-classes/unit/basic-install-test/plugin-config.xml" );
 
-        InstallMojo mojo = (InstallMojo) lookupMojo( "install", testPom );
+        AbstractInstallMojo mojo = (AbstractInstallMojo) lookupMojo( 
"install", testPom );
 
         assertNotNull( mojo );
 
@@ -77,9 +90,11 @@ public class InstallMojoTest
             + "maven-install-test-1.0-SNAPSHOT.jar" );
 
         MavenProject project = (MavenProject) getVariableValueFromObject( 
mojo, "project" );
+        updateMavenProject( project );
         
         setVariableValueToObject( mojo, "reactorProjects", 
Collections.singletonList( project ) );
-        
+        setVariableValueToObject( mojo, "session", createMavenSession() );
+
         artifact = (InstallArtifactStub) project.getArtifact();
 
         artifact.setFile( file );
@@ -88,12 +103,12 @@ public class InstallMojoTest
 
         String groupId = dotToSlashReplacer( artifact.getGroupId() );
 
-        String packaging = getVariableValueFromObject( mojo, "packaging" 
).toString();
-
         File installedArtifact = new File( getBasedir(), LOCAL_REPO + groupId 
+ "/" + artifact.getArtifactId() + "/" +
-            artifact.getVersion() + "/" + artifact.getArtifactId() + "-" + 
artifact.getVersion() + "." + packaging );
+            artifact.getVersion() + "/" + artifact.getArtifactId() + "-" + 
artifact.getVersion() + "." + artifact.getArtifactHandler().getExtension() );
 
         assertTrue( installedArtifact.exists() );
+        
+        assertEquals( 5, FileUtils.getFiles( new File( LOCAL_REPO ), null, 
null ).size() );
     }
 
     public void testBasicInstallWithAttachedArtifacts()
@@ -102,13 +117,15 @@ public class InstallMojoTest
         File testPom = new File( getBasedir(), 
"target/test-classes/unit/basic-install-test-with-attached-artifacts/"
             + "plugin-config.xml" );
 
-        InstallMojo mojo = (InstallMojo) lookupMojo( "install", testPom );
+        AbstractInstallMojo mojo = (AbstractInstallMojo) lookupMojo( 
"install", testPom );
 
         assertNotNull( mojo );
 
         MavenProject project = (MavenProject) getVariableValueFromObject( 
mojo, "project" );
+        updateMavenProject( project );
 
         setVariableValueToObject( mojo, "reactorProjects", 
Collections.singletonList( project ) );
+        setVariableValueToObject( mojo, "session", createMavenSession() );
 
         List attachedArtifacts = project.getAttachedArtifacts();
 
@@ -130,6 +147,8 @@ public class InstallMojoTest
 
             assertTrue( installedArtifact.exists() );
         }
+        
+        assertEquals( 12, FileUtils.getFiles( new File( LOCAL_REPO ), null, 
null ).size() );
     }
 
     public void testUpdateReleaseParamSetToTrue()
@@ -137,7 +156,7 @@ public class InstallMojoTest
     {
         File testPom = new File( getBasedir(), 
"target/test-classes/unit/configured-install-test/plugin-config.xml" );
 
-        InstallMojo mojo = (InstallMojo) lookupMojo( "install", testPom );
+        AbstractInstallMojo mojo = (AbstractInstallMojo) lookupMojo( 
"install", testPom );
 
         assertNotNull( mojo );
 
@@ -145,8 +164,10 @@ public class InstallMojoTest
             + "maven-install-test-1.0-SNAPSHOT.jar" );
 
         MavenProject project = (MavenProject) getVariableValueFromObject( 
mojo, "project" );
-        
+        updateMavenProject( project );
+
         setVariableValueToObject( mojo, "reactorProjects", 
Collections.singletonList( project ) );
+        setVariableValueToObject( mojo, "session", createMavenSession() );
 
         artifact = (InstallArtifactStub) project.getArtifact();
 
@@ -155,6 +176,8 @@ public class InstallMojoTest
         mojo.execute();
 
         assertTrue( artifact.isRelease() );
+        
+        assertEquals( 5, FileUtils.getFiles( new File( LOCAL_REPO ), null, 
null ).size() );
     }
 
     public void testInstallIfArtifactFileIsNull()
@@ -162,13 +185,15 @@ public class InstallMojoTest
     {
         File testPom = new File( getBasedir(), 
"target/test-classes/unit/basic-install-test/plugin-config.xml" );
 
-        InstallMojo mojo = (InstallMojo) lookupMojo( "install", testPom );
+        AbstractInstallMojo mojo = (AbstractInstallMojo) lookupMojo( 
"install", testPom );
 
         assertNotNull( mojo );
 
         MavenProject project = (MavenProject) getVariableValueFromObject( 
mojo, "project" );
+        updateMavenProject( project );
 
         setVariableValueToObject( mojo, "reactorProjects", 
Collections.singletonList( project ) );
+        setVariableValueToObject( mojo, "session", createMavenSession() );
 
         artifact = (InstallArtifactStub) project.getArtifact();
 
@@ -186,6 +211,8 @@ public class InstallMojoTest
         {
             //expected
         }
+        
+        assertFalse( new File( LOCAL_REPO ).exists() );
     }
 
     public void testInstallIfPackagingIsPom()
@@ -194,13 +221,15 @@ public class InstallMojoTest
         File testPom = new File( getBasedir(),
                                  
"target/test-classes/unit/basic-install-test-packaging-pom/" + 
"plugin-config.xml" );
 
-        InstallMojo mojo = (InstallMojo) lookupMojo( "install", testPom );
+        AbstractInstallMojo mojo = (AbstractInstallMojo) lookupMojo( 
"install", testPom );
 
         assertNotNull( mojo );
 
         MavenProject project = (MavenProject) getVariableValueFromObject( 
mojo, "project" );
+        updateMavenProject( project );
 
         setVariableValueToObject( mojo, "reactorProjects", 
Collections.singletonList( project ) );
+        setVariableValueToObject( mojo, "session", createMavenSession() );
 
         String packaging = project.getPackaging();
 
@@ -213,9 +242,11 @@ public class InstallMojoTest
         String groupId = dotToSlashReplacer( artifact.getGroupId() );
 
         File installedArtifact = new File( getBasedir(), LOCAL_REPO + groupId 
+ "/" + artifact.getArtifactId() + "/" +
-            artifact.getVersion() + "/" + artifact.getArtifactId() + "-" + 
artifact.getVersion() + "." + "jar" );
+            artifact.getVersion() + "/" + artifact.getArtifactId() + "-" + 
artifact.getVersion() + "." + "pom" );
 
         assertTrue( installedArtifact.exists() );
+        
+        assertEquals( 4, FileUtils.getFiles( new File( LOCAL_REPO ), null, 
null ).size() );
     }
 
     public void testBasicInstallAndCreateChecksumIsTrue()
@@ -223,15 +254,17 @@ public class InstallMojoTest
     {
         File testPom = new File( getBasedir(), 
"target/test-classes/unit/basic-install-checksum/plugin-config.xml" );
 
-        InstallMojo mojo = (InstallMojo) lookupMojo( "install", testPom );
+        AbstractInstallMojo mojo = (AbstractInstallMojo) lookupMojo( 
"install", testPom );
 
         assertNotNull( mojo );
 
         File file = new File( getBasedir(), 
"target/test-classes/unit/basic-install-checksum/" + "maven-test-jar.jar" );
 
         MavenProject project = (MavenProject) getVariableValueFromObject( 
mojo, "project" );
+        updateMavenProject( project );
 
         setVariableValueToObject( mojo, "reactorProjects", 
Collections.singletonList( project ) );
+        setVariableValueToObject( mojo, "session", createMavenSession() );
 
         artifact = (InstallArtifactStub) project.getArtifact();
 
@@ -300,6 +333,8 @@ public class InstallMojoTest
         assertEquals( actualPomSha1Sum, generatedPomSha1 );
 
         assertTrue( installedArtifact.exists() );
+        
+        assertEquals( 9, FileUtils.getFiles( new File( LOCAL_REPO ), null, 
null ).size() );
     }
 
     public void testSkip()
@@ -315,8 +350,10 @@ public class InstallMojoTest
             + "maven-install-test-1.0-SNAPSHOT.jar" );
 
         MavenProject project = (MavenProject) getVariableValueFromObject( 
mojo, "project" );
+        updateMavenProject( project );
 
         setVariableValueToObject( mojo, "reactorProjects", 
Collections.singletonList( project ) );
+        setVariableValueToObject( mojo, "session", createMavenSession() );
 
         artifact = (InstallArtifactStub) project.getArtifact();
 
@@ -334,6 +371,8 @@ public class InstallMojoTest
             artifact.getVersion() + "/" + artifact.getArtifactId() + "-" + 
artifact.getVersion() + "." + packaging );
 
         assertFalse( installedArtifact.exists() );
+        
+        assertFalse( new File( LOCAL_REPO ).exists() );
     }
 
 
@@ -341,4 +380,22 @@ public class InstallMojoTest
     {
         return parameter.replace( '.', '/' );
     }
+    
+    private MavenSession createMavenSession()
+    {
+        MavenSession session = mock( MavenSession.class );
+        DefaultRepositorySystemSession repositorySession  = new 
DefaultRepositorySystemSession();
+        repositorySession.setLocalRepositoryManager( new 
EnhancedLocalRepositoryManager( new File( LOCAL_REPO )     ) );
+        ProjectBuildingRequest buildingRequest = new 
DefaultProjectBuildingRequest();
+        buildingRequest.setRepositorySession( repositorySession );
+        when( session.getProjectBuildingRequest() ).thenReturn( 
buildingRequest );
+        return session;
+    }
+    
+    private void updateMavenProject( MavenProject project )
+    {
+       project.setGroupId( project.getArtifact().getGroupId() );
+       project.setArtifactId( project.getArtifact().getArtifactId() );
+       project.setVersion( project.getArtifact().getVersion() );
+    }
 }

Modified: 
maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/stubs/InstallArtifactStub.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/stubs/InstallArtifactStub.java?rev=1708008&r1=1708007&r2=1708008&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/stubs/InstallArtifactStub.java
 (original)
+++ 
maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/stubs/InstallArtifactStub.java
 Sun Oct 11 18:39:20 2015
@@ -70,6 +70,11 @@ public class InstallArtifactStub
         return file;
     }
 
+    public String getType()
+    {
+        return "jar";
+    }
+    
     public ArtifactHandler getArtifactHandler()
     {
         return new DefaultArtifactHandler()

Modified: 
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/basic-install-checksum/plugin-config.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/basic-install-checksum/plugin-config.xml?rev=1708008&r1=1708007&r2=1708008&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/basic-install-checksum/plugin-config.xml
 (original)
+++ 
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/basic-install-checksum/plugin-config.xml
 Sun Oct 11 18:39:20 2015
@@ -22,12 +22,6 @@ under the License.
       <plugin>
         <artifactId>maven-install-plugin</artifactId>
         <configuration>
-          <!-- deprecated fields -->
-          
<pomFile>${basedir}/src/test/resources/unit/basic-install-checksum/plugin-config.xml</pomFile>
-          <packaging>jar</packaging>
-          <artifact 
implementation="org.apache.maven.plugin.install.stubs.InstallArtifactStub"/>
-          <attachedArtifacts/>
-
           <localRepository>${localRepository}</localRepository>
           <createChecksum>true</createChecksum>
           <project 
implementation="org.apache.maven.plugin.testing.stubs.MavenProjectStub">

Modified: 
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/basic-install-test-packaging-pom/plugin-config.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/basic-install-test-packaging-pom/plugin-config.xml?rev=1708008&r1=1708007&r2=1708008&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/basic-install-test-packaging-pom/plugin-config.xml
 (original)
+++ 
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/basic-install-test-packaging-pom/plugin-config.xml
 Sun Oct 11 18:39:20 2015
@@ -22,13 +22,7 @@ under the License.
       <plugin>
         <artifactId>maven-install-plugin</artifactId>
         <configuration>
-          <!-- deprecated fields -->
-          
<pomFile>${basedir}/src/test/resources/unit/basic-install-test-packaging-pom/plugin-config.xml</pomFile>
-          <packaging>pom</packaging>
-          <artifact 
implementation="org.apache.maven.plugin.install.stubs.InstallArtifactStub"/>
-          <attachedArtifacts/>
           <localRepository>${localRepository}</localRepository>
-
           <project 
implementation="org.apache.maven.plugin.testing.stubs.MavenProjectStub">
             
<file>${basedir}/src/test/resources/unit/basic-install-test-packaging-pom/plugin-config.xml</file>
             <packaging>pom</packaging>

Modified: 
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/basic-install-test-with-attached-artifacts/plugin-config.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/basic-install-test-with-attached-artifacts/plugin-config.xml?rev=1708008&r1=1708007&r2=1708008&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/basic-install-test-with-attached-artifacts/plugin-config.xml
 (original)
+++ 
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/basic-install-test-with-attached-artifacts/plugin-config.xml
 Sun Oct 11 18:39:20 2015
@@ -22,16 +22,6 @@ under the License.
       <plugin>
         <artifactId>maven-install-plugin</artifactId>
         <configuration>
-          <!-- @deprecated fields -->
-          
<pomFile>${basedir}/src/test/resources/unit/basic-install-test-with-attached-artifacts/plugin-config.xml
-          </pomFile>
-          <packaging>jar</packaging>
-          <artifact 
implementation="org.apache.maven.plugin.install.stubs.InstallArtifactStub"/>
-          <attachedArtifacts>
-            <attachedArtifact 
implementation="org.apache.maven.plugin.install.stubs.AttachedArtifactStub0"/>
-            <attachedArtifact 
implementation="org.apache.maven.plugin.install.stubs.AttachedArtifactStub1"/>
-          </attachedArtifacts>
-
           <localRepository>${localRepository}</localRepository>
           <project 
implementation="org.apache.maven.plugin.testing.stubs.MavenProjectStub">
             
<file>${basedir}/src/test/resources/unit/basic-install-test-with-attached-artifacts/plugin-config.xml</file>

Modified: 
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/basic-install-test/plugin-config.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/basic-install-test/plugin-config.xml?rev=1708008&r1=1708007&r2=1708008&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/basic-install-test/plugin-config.xml
 (original)
+++ 
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/basic-install-test/plugin-config.xml
 Sun Oct 11 18:39:20 2015
@@ -22,12 +22,6 @@ under the License.
       <plugin>
         <artifactId>maven-install-plugin</artifactId>
         <configuration>
-          <!-- @deprecated fields -->
-          
<pomFile>${basedir}/src/test/resources/unit/basic-install-test/plugin-config.xml</pomFile>
-          <packaging>jar</packaging>
-          <artifact 
implementation="org.apache.maven.plugin.install.stubs.InstallArtifactStub"/>
-          <attachedArtifacts/>
-
           <localRepository>${localRepository}</localRepository>
           <project 
implementation="org.apache.maven.plugin.testing.stubs.MavenProjectStub">
             
<file>${basedir}/src/test/resources/unit/basic-install-test/plugin-config.xml</file>

Modified: 
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/configured-install-test/plugin-config.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/configured-install-test/plugin-config.xml?rev=1708008&r1=1708007&r2=1708008&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/configured-install-test/plugin-config.xml
 (original)
+++ 
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/configured-install-test/plugin-config.xml
 Sun Oct 11 18:39:20 2015
@@ -22,12 +22,6 @@ under the License.
       <plugin>
         <artifactId>maven-install-plugin</artifactId>
         <configuration>
-          <!-- deprecated fields -->
-          
<pomFile>${basedir}/src/test/resources/unit/configured-install-test/plugin-config.xml</pomFile>
-          <packaging>jar</packaging>
-          <artifact 
implementation="org.apache.maven.plugin.install.stubs.InstallArtifactStub"/>
-          <attachedArtifacts/>
-
           <updateReleaseInfo>true</updateReleaseInfo>
           <localRepository>${localRepository}</localRepository>
           <project 
implementation="org.apache.maven.plugin.testing.stubs.MavenProjectStub">


Reply via email to