Author: rfscholte
Date: Sat Dec 15 17:18:05 2012
New Revision: 1422291

URL: http://svn.apache.org/viewvc?rev=1422291&view=rev
Log:
[MINSTALL-93] Add installAtEnd option for multimodule projects 

Added:
    maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-fail/
    
maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-fail/invoker.properties
    maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-fail/module1/
    
maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-fail/module1/pom.xml
    maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-fail/pom.xml
    
maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-fail/verify.groovy
    maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-pass/
    maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-pass/module1/
    
maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-pass/module1/pom.xml
    maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-pass/pom.xml
    
maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-pass/verify.groovy
Modified:
    maven/plugins/trunk/maven-install-plugin/pom.xml
    
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/InstallMojoTest.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

Modified: maven/plugins/trunk/maven-install-plugin/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/pom.xml?rev=1422291&r1=1422290&r2=1422291&view=diff
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-install-plugin/pom.xml Sat Dec 15 17:18:05 2012
@@ -168,8 +168,8 @@ under the License.
               <version>1.7</version>
               <configuration>
                 <debug>true</debug>
-                <projectsDirectory>src/it</projectsDirectory>
                 
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+                <cloneClean>true</cloneClean>
                 <pomIncludes>
                   <pomInclude>*/pom.xml</pomInclude>
                   <pomInclude>*/non-default-pom.xml</pomInclude>

Added: 
maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-fail/invoker.properties
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-fail/invoker.properties?rev=1422291&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-fail/invoker.properties
 (added)
+++ 
maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-fail/invoker.properties
 Sat Dec 15 17:18:05 2012
@@ -0,0 +1 @@
+invoker.buildResult=failure
\ No newline at end of file

Added: 
maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-fail/module1/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-fail/module1/pom.xml?rev=1422291&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-fail/module1/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-fail/module1/pom.xml
 Sat Dec 15 17:18:05 2012
@@ -0,0 +1,47 @@
+<?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>
+
+  <parent>
+    <groupId>org.apache.maven.its.install.dae.fail</groupId>
+    <artifactId>dae</artifactId>
+    <version>1.0</version>
+  </parent>
+  <artifactId>module1</artifactId>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <version>1.2</version>
+        <executions>
+          <execution>
+            <id>enforce</id>
+            <goals>
+              <goal>enforce</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <AlwaysFail />
+              </rules>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Added: 
maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-fail/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-fail/pom.xml?rev=1422291&view=auto
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-fail/pom.xml 
(added)
+++ maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-fail/pom.xml 
Sat Dec 15 17:18:05 2012
@@ -0,0 +1,75 @@
+<?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.dae.fail</groupId>
+  <artifactId>dae</artifactId>
+  <version>1.0</version>
+  <packaging>pom</packaging>
+
+  <description>
+    Tests installation at end.
+  </description>
+
+  <properties>
+    <maven.test.skip>true</maven.test.skip>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.0.2</version>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-install-plugin</artifactId>
+        <version>@project.version@</version>
+        <configuration>
+          <installAtEnd>true</installAtEnd>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <version>2.1</version>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>2.2</version>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>2.12</version>
+      </plugin>
+    </plugins>
+  </build>
+  
+  <modules>
+    <module>module1</module>
+  </modules>
+
+</project>

Added: 
maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-fail/verify.groovy
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-fail/verify.groovy?rev=1422291&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-fail/verify.groovy
 (added)
+++ 
maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-fail/verify.groovy
 Sat Dec 15 17:18:05 2012
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+assert !( new File( basedir, 
"../../local-repo/org/apache/maven/its/install/dae/fail/dae/1.0/dae-1.0.pom" 
).exists() )
+assert !( new File( basedir, 
"../../local-repo/org/apache/maven/its/install/dae/fail/module1/1.0/module1-1.0.pom"
 ).exists() )
+
+File buildLog = new File( basedir, 'build.log' )
+assert buildLog.exists()
+assert buildLog.text.contains( "[INFO] Installing 
org.apache.maven.its.install.dae.fail:dae:1.0 at end" )
+

Added: 
maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-pass/module1/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-pass/module1/pom.xml?rev=1422291&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-pass/module1/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-pass/module1/pom.xml
 Sat Dec 15 17:18:05 2012
@@ -0,0 +1,47 @@
+<?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>
+
+  <parent>
+    <groupId>org.apache.maven.its.install.dae.pass</groupId>
+    <artifactId>dae</artifactId>
+    <version>1.0</version>
+  </parent>
+  <artifactId>module1</artifactId>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <version>1.2</version>
+        <executions>
+          <execution>
+            <id>enforce</id>
+            <goals>
+              <goal>enforce</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <AlwaysPass />
+              </rules>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Added: 
maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-pass/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-pass/pom.xml?rev=1422291&view=auto
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-pass/pom.xml 
(added)
+++ maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-pass/pom.xml 
Sat Dec 15 17:18:05 2012
@@ -0,0 +1,75 @@
+<?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.dae.pass</groupId>
+  <artifactId>dae</artifactId>
+  <version>1.0</version>
+  <packaging>pom</packaging>
+
+  <description>
+    Tests installation at end.
+  </description>
+
+  <properties>
+    <maven.test.skip>true</maven.test.skip>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.0.2</version>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-install-plugin</artifactId>
+        <version>@project.version@</version>
+        <configuration>
+          <installAtEnd>true</installAtEnd>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <version>2.1</version>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>2.2</version>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>2.12</version>
+      </plugin>
+    </plugins>
+  </build>
+  
+  <modules>
+    <module>module1</module>
+  </modules>
+
+</project>

Added: 
maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-pass/verify.groovy
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-pass/verify.groovy?rev=1422291&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-pass/verify.groovy
 (added)
+++ 
maven/plugins/trunk/maven-install-plugin/src/it/install-at-end-pass/verify.groovy
 Sat Dec 15 17:18:05 2012
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+assert new File( basedir, 
"../../local-repo/org/apache/maven/its/install/dae/pass/dae/1.0/dae-1.0.pom" 
).exists()
+assert new File( basedir, 
"../../local-repo/org/apache/maven/its/install/dae/pass/module1/1.0/module1-1.0.pom"
 ).exists()
+
+File buildLog = new File( basedir, 'build.log' )
+assert buildLog.exists()
+assert buildLog.text.contains( "[INFO] Installing 
org.apache.maven.its.install.dae.pass:dae:1.0 at end" )
+

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=1422291&r1=1422290&r2=1422291&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
 Sat Dec 15 17:18:05 2012
@@ -19,21 +19,23 @@ package org.apache.maven.plugin.install;
  * under the License.
  */
 
+import java.io.File;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+
 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.Component;
 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.ProjectArtifactMetadata;
 
-import java.io.File;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-
 /**
  * Installs the project's main artifact, and any other artifacts attached by 
other plugins in the lifecycle, to the local repository.
  *
@@ -44,12 +46,32 @@ import java.util.List;
 public class InstallMojo
     extends AbstractInstallMojo
 {
+    
+    /**
+     */
+    @Component
+    private MavenProject project;
+    
+    @Parameter( defaultValue = "${reactorProjects}", required = true, readonly 
= true )
+    private List<MavenProject> reactorProjects;
+    
+    /**
+     * Whether every project should be deployed during its own deploy-phase or 
at the end of the multimodule build.
+     * If set to {@code true} and the build fails, none of the reactor 
projects is deployed 
+     * 
+     * @since 2.5
+     */
+    @Parameter( defaultValue = "false", property = "installAtEnd" )
+    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;
@@ -64,11 +86,13 @@ public class InstallMojo
     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 attachedArtifacts;
@@ -82,6 +106,36 @@ public class InstallMojo
             return;
         }
 
+        if( !installAtEnd )
+        {
+            installProject( project );
+        }
+        else
+        {
+            MavenProject lastProject = reactorProjects.get( 
reactorProjects.size() - 1 );
+            if( lastProject.equals( project ) )
+            {
+                for( MavenProject reactorProject : reactorProjects )
+                {
+                    installProject( reactorProject );
+                }
+            }
+            else
+            {
+                getLog().info( "Installing " + project.getGroupId() + ":" + 
project.getArtifactId() + 
+                               ":" + project.getVersion() + " at end" );
+            }
+        }
+    }
+
+    private void installProject( MavenProject project )
+        throws MojoExecutionException
+    {
+        Artifact artifact = project.getArtifact();
+        String packaging = project.getPackaging();
+        File pomFile = project.getFile();
+        List attachedArtifacts = project.getAttachedArtifacts();
+        
         // TODO: push into transformation
         boolean isPomArtifact = "pom".equals( packaging );
 

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=1422291&r1=1422290&r2=1422291&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 Dec 15 17:18:05 2012
@@ -25,6 +25,7 @@ import org.apache.maven.plugin.MojoExecu
 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.MavenProject;
 import org.codehaus.plexus.util.FileUtils;
 
 import java.io.File;
@@ -76,7 +77,9 @@ public class InstallMojoTest
         File file = new File( getBasedir(), 
"target/test-classes/unit/basic-install-test/target/" +
             "maven-install-test-1.0-SNAPSHOT.jar" );
 
-        artifact = (InstallArtifactStub) getVariableValueFromObject( mojo, 
"artifact" );
+        MavenProject project = (MavenProject) getVariableValueFromObject( 
mojo, "project" );
+
+        artifact = (InstallArtifactStub) project.getArtifact();
 
         artifact.setFile( file );
 
@@ -101,12 +104,14 @@ public class InstallMojoTest
         InstallMojo mojo = (InstallMojo) lookupMojo( "install", testPom );
 
         assertNotNull( mojo );
+        
+        MavenProject project = (MavenProject) getVariableValueFromObject( 
mojo, "project" );
 
-        List attachedArtifacts = (ArrayList) getVariableValueFromObject( mojo, 
"attachedArtifacts" );
+        List attachedArtifacts = project.getAttachedArtifacts();
 
         mojo.execute();
 
-        String packaging = getVariableValueFromObject( mojo, "packaging" 
).toString();
+        String packaging = project.getPackaging();
 
         String groupId = "";
 
@@ -136,7 +141,9 @@ public class InstallMojoTest
         File file = new File( getBasedir(), 
"target/test-classes/unit/configured-install-test/target/" +
             "maven-install-test-1.0-SNAPSHOT.jar" );
 
-        artifact = (InstallArtifactStub) getVariableValueFromObject( mojo, 
"artifact" );
+        MavenProject project = (MavenProject) getVariableValueFromObject( 
mojo, "project" );
+
+        artifact = (InstallArtifactStub) project.getArtifact();
 
         artifact.setFile( file );
 
@@ -154,7 +161,9 @@ public class InstallMojoTest
 
         assertNotNull( mojo );
 
-        artifact = (InstallArtifactStub) getVariableValueFromObject( mojo, 
"artifact" );
+        MavenProject project = (MavenProject) getVariableValueFromObject( 
mojo, "project" );
+
+        artifact = (InstallArtifactStub) project.getArtifact();
 
         artifact.setFile( null );
 
@@ -182,11 +191,13 @@ public class InstallMojoTest
 
         assertNotNull( mojo );
 
-        String packaging = (String) getVariableValueFromObject( mojo, 
"packaging" );
+        MavenProject project = (MavenProject) getVariableValueFromObject( 
mojo, "project" );
+
+        String packaging = project.getPackaging();
 
         assertEquals( "pom", packaging );
 
-        artifact = (InstallArtifactStub) getVariableValueFromObject( mojo, 
"artifact" );
+        artifact = (InstallArtifactStub) project.getArtifact();
 
         mojo.execute();
 
@@ -209,8 +220,10 @@ public class InstallMojoTest
 
         File file = new File( getBasedir(), 
"target/test-classes/unit/basic-install-checksum/" + "maven-test-jar.jar" );
 
-        artifact = (InstallArtifactStub) getVariableValueFromObject( mojo, 
"artifact" );
+        MavenProject project = (MavenProject) getVariableValueFromObject( 
mojo, "project" );
 
+        artifact = (InstallArtifactStub) project.getArtifact();
+        
         boolean createChecksum = ( (Boolean) getVariableValueFromObject( mojo, 
"createChecksum" ) ).booleanValue();
 
         assertTrue( createChecksum );
@@ -245,7 +258,7 @@ public class InstallMojoTest
 
         String groupId = dotToSlashReplacer( artifact.getGroupId() );
 
-        String packaging = getVariableValueFromObject( mojo, "packaging" 
).toString();
+        String packaging = project.getPackaging();
 
         String localPath = getBasedir() + "/" + LOCAL_REPO + groupId + "/" + 
artifact.getArtifactId() + "/" +
             artifact.getVersion() + "/" + artifact.getArtifactId() + "-" + 
artifact.getVersion();
@@ -288,8 +301,10 @@ public class InstallMojoTest
         File file = new File( getBasedir(), 
"target/test-classes/unit/basic-install-test/target/" +
             "maven-install-test-1.0-SNAPSHOT.jar" );
 
-        artifact = (InstallArtifactStub) getVariableValueFromObject( mojo, 
"artifact" );
+        MavenProject project = (MavenProject) getVariableValueFromObject( 
mojo, "project" );
 
+        artifact = (InstallArtifactStub) project.getArtifact();
+        
         artifact.setFile( file );
 
         mojo.setSkip(true);
@@ -298,7 +313,7 @@ public class InstallMojoTest
 
         String groupId = dotToSlashReplacer( artifact.getGroupId() );
 
-        String packaging = getVariableValueFromObject( mojo, "packaging" 
).toString();
+        String packaging = project.getPackaging();
 
         File installedArtifact = new File( getBasedir(), LOCAL_REPO + groupId 
+ "/" + artifact.getArtifactId() + "/" +
            artifact.getVersion() + "/" + artifact.getArtifactId() + "-" + 
artifact.getVersion() + "." + packaging );

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=1422291&r1=1422290&r2=1422291&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
 Sat Dec 15 17:18:05 2012
@@ -22,12 +22,20 @@ 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">
+            
<file>${basedir}/src/test/resources/unit/basic-install-checksum/plugin-config.xml</file>
+            <packaging>jar</packaging>
+            <artifact 
implementation="org.apache.maven.plugin.install.stubs.InstallArtifactStub"/>
+            <attachedArtifacts/>
+          </project>
         </configuration>
       </plugin>
     </plugins>

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=1422291&r1=1422290&r2=1422291&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
 Sat Dec 15 17:18:05 2012
@@ -22,11 +22,19 @@ 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>
+            <artifact 
implementation="org.apache.maven.plugin.install.stubs.InstallArtifactStub"/>
+            <attachedArtifacts/>
+          </project>
         </configuration>
       </plugin>
     </plugins>

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=1422291&r1=1422290&r2=1422291&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
 Sat Dec 15 17:18:05 2012
@@ -22,15 +22,27 @@ under the License.
       <plugin>
         <artifactId>maven-install-plugin</artifactId>
         <configuration>
-          
<pomFile>${basedir}/src/test/resources/unit/basic-install-test-with-attached-artifacts/plugin-config.xml
-          </pomFile>
+          <!-- @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>
+            <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>
+          </project>
         </configuration>
       </plugin>
     </plugins>

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=1422291&r1=1422290&r2=1422291&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
 Sat Dec 15 17:18:05 2012
@@ -22,11 +22,19 @@ 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>
+            <packaging>jar</packaging>
+            <artifact 
implementation="org.apache.maven.plugin.install.stubs.InstallArtifactStub"/>
+            <attachedArtifacts/>
+          </project>
         </configuration>
       </plugin>
     </plugins>

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=1422291&r1=1422290&r2=1422291&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
 Sat Dec 15 17:18:05 2012
@@ -22,12 +22,20 @@ 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"/>
-          <updateReleaseInfo>true</updateReleaseInfo>
           <attachedArtifacts/>
+          
+          <updateReleaseInfo>true</updateReleaseInfo>
           <localRepository>${localRepository}</localRepository>
+          <project 
implementation="org.apache.maven.plugin.testing.stubs.MavenProjectStub">
+            
<file>${basedir}/src/test/resources/unit/configured-install-test/plugin-config.xml</file>
+            <packaging>jar</packaging>
+            <artifact 
implementation="org.apache.maven.plugin.install.stubs.InstallArtifactStub"/>
+            <attachedArtifacts/>
+          </project>
         </configuration>
       </plugin>
     </plugins>


Reply via email to