You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2015/05/09 19:04:14 UTC
svn commit: r1678503 - in /maven/plugins/branches/m-install-p-3.0: ./
src/main/java/org/apache/maven/plugin/install/
src/test/java/org/apache/maven/plugin/install/
Author: rfscholte
Date: Sat May 9 17:04:13 2015
New Revision: 1678503
URL: http://svn.apache.org/r1678503
Log:
Maven prerequisite now 3.0
Remove maven-compat dependency (give it test scope due to maven-plugin-testing-harness)
Introduce maven-artifact-transfer
These are the minimum changes required. Aether has a much more efficient way to install artifacts, so plugin code still needs to be optimized and cleaned up
Modified:
maven/plugins/branches/m-install-p-3.0/pom.xml
maven/plugins/branches/m-install-p-3.0/src/main/java/org/apache/maven/plugin/install/AbstractInstallMojo.java
maven/plugins/branches/m-install-p-3.0/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java
maven/plugins/branches/m-install-p-3.0/src/main/java/org/apache/maven/plugin/install/InstallMojo.java
maven/plugins/branches/m-install-p-3.0/src/test/java/org/apache/maven/plugin/install/InstallMojoTest.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=1678503&r1=1678502&r2=1678503&view=diff
==============================================================================
--- maven/plugins/branches/m-install-p-3.0/pom.xml (original)
+++ maven/plugins/branches/m-install-p-3.0/pom.xml Sat May 9 17:04:13 2015
@@ -70,21 +70,11 @@ 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-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>
@@ -122,7 +112,7 @@ under the License.
</exclusion>
</exclusions>
</dependency>
- <dependency> <!-- used by maven-plugin-testing-harness, don't give it compile scope -->
+ <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>
Modified: maven/plugins/branches/m-install-p-3.0/src/main/java/org/apache/maven/plugin/install/AbstractInstallMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/m-install-p-3.0/src/main/java/org/apache/maven/plugin/install/AbstractInstallMojo.java?rev=1678503&r1=1678502&r2=1678503&view=diff
==============================================================================
--- maven/plugins/branches/m-install-p-3.0/src/main/java/org/apache/maven/plugin/install/AbstractInstallMojo.java (original)
+++ maven/plugins/branches/m-install-p-3.0/src/main/java/org/apache/maven/plugin/install/AbstractInstallMojo.java Sat May 9 17:04:13 2015
@@ -27,11 +27,13 @@ import org.apache.maven.artifact.Artifac
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.metadata.ArtifactMetadata;
import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.shared.artifact.install.ArtifactInstaller;
+import org.apache.maven.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/branches/m-install-p-3.0/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/m-install-p-3.0/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java?rev=1678503&r1=1678502&r2=1678503&view=diff
==============================================================================
--- maven/plugins/branches/m-install-p-3.0/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java (original)
+++ maven/plugins/branches/m-install-p-3.0/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java Sat May 9 17:04:13 2015
@@ -39,7 +39,6 @@ import java.util.regex.Pattern;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.metadata.ArtifactMetadata;
-import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.InputLocation;
import org.apache.maven.model.Model;
import org.apache.maven.model.Parent;
@@ -160,10 +159,6 @@ public class InstallFileMojo
@Parameter( property = "localRepositoryPath" )
private File localRepositoryPath;
- @Parameter( defaultValue = "${session}", required = true, readonly = true )
- private MavenSession session;
-
-
/**
* The component used to validate the user-supplied artifact coordinates.
*/
@@ -191,16 +186,9 @@ public class InstallFileMojo
// ----------------------------------------------------------------------
if ( localRepositoryPath != null )
{
- try
- {
- buildingRequest = installer.setLocalRepositoryBasedir( buildingRequest, localRepositoryPath );
-
- getLog().debug( "localRepoPath: " + installer.getLocalRepositoryBasedir( buildingRequest ) );
- }
- catch ( ArtifactInstallerException e )
- {
- throw new MojoExecutionException( "MalformedURLException: " + e.getMessage(), e );
- }
+ buildingRequest = repositoryManager.setLocalRepositoryBasedir( buildingRequest, localRepositoryPath );
+
+ getLog().debug( "localRepoPath: " + repositoryManager.getLocalRepositoryBasedir( buildingRequest ) );
}
if ( pomFile != null )
Modified: maven/plugins/branches/m-install-p-3.0/src/main/java/org/apache/maven/plugin/install/InstallMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/m-install-p-3.0/src/main/java/org/apache/maven/plugin/install/InstallMojo.java?rev=1678503&r1=1678502&r2=1678503&view=diff
==============================================================================
--- maven/plugins/branches/m-install-p-3.0/src/main/java/org/apache/maven/plugin/install/InstallMojo.java (original)
+++ maven/plugins/branches/m-install-p-3.0/src/main/java/org/apache/maven/plugin/install/InstallMojo.java Sat May 9 17:04:13 2015
@@ -28,8 +28,6 @@ import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.metadata.ArtifactMetadata;
-import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
@@ -68,9 +66,6 @@ public class InstallMojo
@Parameter( defaultValue = "${reactorProjects}", required = true, readonly = true )
private List<MavenProject> reactorProjects;
- @Parameter( defaultValue = "${session}", required = true, readonly = true )
- private MavenSession session;
-
/**
* 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.
@@ -144,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 )
{
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=1678503&r1=1678502&r2=1678503&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 May 9 17:04:13 2015
@@ -72,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 );
}
@@ -82,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 );
@@ -117,7 +117,7 @@ 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 );
@@ -156,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 );
@@ -185,7 +185,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 );
@@ -221,7 +221,7 @@ 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 );
@@ -254,7 +254,7 @@ 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 );