Author: rfscholte Date: Sat Mar 14 09:53:51 2015 New Revision: 1666646 URL: http://svn.apache.org/r1666646 Log: migrate to M3.0. Step 1: only update maven version and compiler source/target - fix maven dependencies (add maven-compat, to be removed) - upgrade maven-plugin-testing-harness to 2.1 (matching Aether of Maven 3.0) - Adjust junit tests by preparing LegacySupport (to be removed)
Added: maven/plugins/branches/m-install-p-3.0/ - copied from r1665368, maven/plugins/trunk/maven-install-plugin/ Modified: maven/plugins/branches/m-install-p-3.0/pom.xml maven/plugins/branches/m-install-p-3.0/src/test/java/org/apache/maven/plugin/install/InstallFileMojoTest.java maven/plugins/branches/m-install-p-3.0/src/test/java/org/apache/maven/plugin/install/InstallMojoTest.java maven/plugins/branches/m-install-p-3.0/src/test/java/org/apache/maven/plugin/install/stubs/InstallArtifactStub.java Modified: maven/plugins/branches/m-install-p-3.0/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/branches/m-install-p-3.0/pom.xml?rev=1666646&r1=1665368&r2=1666646&view=diff ============================================================================== --- maven/plugins/branches/m-install-p-3.0/pom.xml (original) +++ maven/plugins/branches/m-install-p-3.0/pom.xml Sat Mar 14 09:53:51 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> @@ -68,24 +70,30 @@ under the License. <artifactId>maven-plugin-api</artifactId> <version>${mavenVersion}</version> </dependency> - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-project</artifactId> - <version>${mavenVersion}</version> - </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-manager</artifactId> + <artifactId>maven-artifact</artifactId> <version>${mavenVersion}</version> </dependency> - <dependency> + + <dependency> <!-- TO BE REMOVED --> <groupId>org.apache.maven</groupId> - <artifactId>maven-artifact</artifactId> + <artifactId>maven-compat</artifactId> <version>${mavenVersion}</version> </dependency> @@ -99,7 +107,7 @@ under the License. <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> </dependency> <dependency> Modified: maven/plugins/branches/m-install-p-3.0/src/test/java/org/apache/maven/plugin/install/InstallFileMojoTest.java URL: http://svn.apache.org/viewvc/maven/plugins/branches/m-install-p-3.0/src/test/java/org/apache/maven/plugin/install/InstallFileMojoTest.java?rev=1666646&r1=1665368&r2=1666646&view=diff ============================================================================== --- maven/plugins/branches/m-install-p-3.0/src/test/java/org/apache/maven/plugin/install/InstallFileMojoTest.java (original) +++ maven/plugins/branches/m-install-p-3.0/src/test/java/org/apache/maven/plugin/install/InstallFileMojoTest.java Sat Mar 14 09:53:51 2015 @@ -19,12 +19,18 @@ package org.apache.maven.plugin.install; * under the License. */ +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.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.util.DefaultRepositorySystemSession; import java.io.File; import java.io.Reader; @@ -57,6 +63,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() @@ -90,31 +101,6 @@ public class InstallFileMojoTest 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() ); - } public void testInstallFileWithClassifier() throws Exception Modified: maven/plugins/branches/m-install-p-3.0/src/test/java/org/apache/maven/plugin/install/InstallMojoTest.java URL: http://svn.apache.org/viewvc/maven/plugins/branches/m-install-p-3.0/src/test/java/org/apache/maven/plugin/install/InstallMojoTest.java?rev=1666646&r1=1665368&r2=1666646&view=diff ============================================================================== --- maven/plugins/branches/m-install-p-3.0/src/test/java/org/apache/maven/plugin/install/InstallMojoTest.java (original) +++ maven/plugins/branches/m-install-p-3.0/src/test/java/org/apache/maven/plugin/install/InstallMojoTest.java Sat Mar 14 09:53:51 2015 @@ -21,12 +21,18 @@ package org.apache.maven.plugin.install; import org.apache.maven.artifact.metadata.ArtifactMetadata; import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.execution.DefaultMavenExecutionRequest; +import org.apache.maven.execution.MavenExecutionRequest; +import org.apache.maven.execution.MavenSession; +import org.apache.maven.plugin.LegacySupport; 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.MavenProject; import org.apache.maven.shared.utils.io.FileUtils; +import org.sonatype.aether.RepositorySystemSession; +import org.sonatype.aether.util.DefaultRepositorySystemSession; import java.io.File; import java.util.Collections; @@ -52,6 +58,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() Modified: maven/plugins/branches/m-install-p-3.0/src/test/java/org/apache/maven/plugin/install/stubs/InstallArtifactStub.java URL: http://svn.apache.org/viewvc/maven/plugins/branches/m-install-p-3.0/src/test/java/org/apache/maven/plugin/install/stubs/InstallArtifactStub.java?rev=1666646&r1=1665368&r2=1666646&view=diff ============================================================================== --- maven/plugins/branches/m-install-p-3.0/src/test/java/org/apache/maven/plugin/install/stubs/InstallArtifactStub.java (original) +++ maven/plugins/branches/m-install-p-3.0/src/test/java/org/apache/maven/plugin/install/stubs/InstallArtifactStub.java Sat Mar 14 09:53:51 2015 @@ -70,6 +70,11 @@ public class InstallArtifactStub return file; } + public String getType() + { + return "jar"; + } + public ArtifactHandler getArtifactHandler() { return new DefaultArtifactHandler()