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/10/18 13:07:34 UTC
svn commit: r1709260 - in /maven/plugins/trunk/maven-deploy-plugin/src:
main/java/org/apache/maven/plugin/deploy/
test/resources/unit/basic-deploy-pom/ test/resources/unit/basic-deploy-scp/
test/resources/unit/basic-deploy-test/ test/resources/unit/bas...
Author: rfscholte
Date: Sun Oct 18 11:07:33 2015
New Revision: 1709260
URL: http://svn.apache.org/viewvc?rev=1709260&view=rev
Log:
Replace localRepository with RepositoryManager, push down to deploy-file since deploy doesn't use it
Modified:
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/AbstractDeployMojo.java
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployFileMojo.java
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java
maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deploy-pom/plugin-config.xml
maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deploy-scp/plugin-config.xml
maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deploy-test/plugin-config.xml
maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deploy-with-attached-artifacts/plugin-config.xml
maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/deploy-file-artifact-not-jar/plugin-config.xml
maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/deploy-file-classifier/plugin-config.xml
maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/deploy-file-legacy-repository-layout/plugin-config.xml
maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/deploy-file-pom-file/plugin-config.xml
maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/deploy-file-test/plugin-config.xml
Modified: maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/AbstractDeployMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/AbstractDeployMojo.java?rev=1709260&r1=1709259&r2=1709260&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/AbstractDeployMojo.java (original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/AbstractDeployMojo.java Sun Oct 18 11:07:33 2015
@@ -61,11 +61,6 @@ public abstract class AbstractDeployMojo
private Map<String, ArtifactRepositoryLayout> repositoryLayouts;
/**
- */
- @Parameter( defaultValue = "${localRepository}", required = true, readonly = true )
- private ArtifactRepository localRepository;
-
- /**
* Flag whether Maven is currently in online/offline mode.
*/
@Parameter( defaultValue = "${settings.offline}", readonly = true )
@@ -101,16 +96,6 @@ public abstract class AbstractDeployMojo
this.deployer = deployer;
}
- public ArtifactRepository getLocalRepository()
- {
- return localRepository;
- }
-
- public void setLocalRepository( ArtifactRepository localRepository )
- {
- this.localRepository = localRepository;
- }
-
void failIfOffline()
throws MojoFailureException
{
@@ -153,7 +138,7 @@ public abstract class AbstractDeployMojo
* @throws ArtifactDeployerException if an error occurred deploying the artifact
*/
protected void deploy( Collection<Artifact> artifacts, ArtifactRepository deploymentRepository,
- ArtifactRepository localRepository, int retryFailedDeploymentCount )
+ int retryFailedDeploymentCount )
throws ArtifactDeployerException
{
@@ -200,4 +185,9 @@ public abstract class AbstractDeployMojo
return new MavenArtifactRepository( id, url, layout, new ArtifactRepositoryPolicy(),
new ArtifactRepositoryPolicy() );
}
+
+ protected final MavenSession getSession()
+ {
+ return session;
+ }
}
Modified: maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployFileMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployFileMojo.java?rev=1709260&r1=1709259&r2=1709260&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployFileMojo.java (original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployFileMojo.java Sun Oct 18 11:07:33 2015
@@ -35,7 +35,6 @@ import java.util.jar.JarFile;
import java.util.regex.Pattern;
import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.metadata.ArtifactMetadata;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.model.InputLocation;
@@ -43,8 +42,8 @@ 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.ModelProblemCollector;
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;
@@ -57,6 +56,7 @@ import org.apache.maven.project.MavenPro
import org.apache.maven.project.MavenProjectHelper;
import org.apache.maven.project.artifact.ProjectArtifactMetadata;
import org.apache.maven.shared.artifact.deploy.ArtifactDeployerException;
+import org.apache.maven.shared.artifact.repository.RepositoryManager;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.ReaderFactory;
@@ -211,7 +211,10 @@ public class DeployFileMojo
*/
@Parameter( property = "files" )
private String files;
-
+
+ @Component
+ private RepositoryManager repoManager;
+
void initProperties()
throws MojoExecutionException
{
@@ -343,12 +346,12 @@ public class DeployFileMojo
{
if ( pomFile != null )
{
- ArtifactMetadata metadata = new ProjectArtifactMetadata( artifact, pomFile );
+ ProjectArtifactMetadata metadata = new ProjectArtifactMetadata( artifact, pomFile );
artifact.addMetadata( metadata );
}
else if ( generatePom )
{
- ArtifactMetadata metadata = new ProjectArtifactMetadata( artifact, generatePomFile() );
+ ProjectArtifactMetadata metadata = new ProjectArtifactMetadata( artifact, generatePomFile() );
artifact.addMetadata( metadata );
}
}
@@ -469,7 +472,7 @@ public class DeployFileMojo
try
{
- deploy( deployableArtifacts, deploymentRepository, getLocalRepository(), getRetryFailedDeploymentCount() );
+ deploy( deployableArtifacts, deploymentRepository, getRetryFailedDeploymentCount() );
}
catch ( ArtifactDeployerException e )
{
@@ -486,8 +489,8 @@ public class DeployFileMojo
*/
private File getLocalRepoFile( Artifact artifact )
{
- String path = getLocalRepository().pathOf( artifact );
- return new File( getLocalRepository().getBasedir(), path );
+ String path = repoManager.getPathForLocalArtifact( getSession().getProjectBuildingRequest(), artifact );
+ return new File( repoManager.getLocalRepositoryBasedir( getSession().getProjectBuildingRequest() ), path );
}
/**
@@ -731,4 +734,5 @@ public class DeployFileMojo
return message.toString();
}
};
+
}
Modified: maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java?rev=1709260&r1=1709259&r2=1709260&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java (original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java Sun Oct 18 11:07:33 2015
@@ -29,7 +29,6 @@ import java.util.regex.Pattern;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.ArtifactUtils;
-import org.apache.maven.artifact.metadata.ArtifactMetadata;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.plugin.MojoExecutionException;
@@ -203,7 +202,7 @@ public class DeployMojo
boolean isPomArtifact = "pom".equals( packaging );
if ( !isPomArtifact )
{
- ArtifactMetadata metadata = new ProjectArtifactMetadata( artifact, pomFile );
+ ProjectArtifactMetadata metadata = new ProjectArtifactMetadata( artifact, pomFile );
artifact.addMetadata( metadata );
}
else
@@ -275,7 +274,7 @@ public class DeployMojo
deployableArtifacts.add( attached );
}
- deploy( deployableArtifacts, repo, getLocalRepository(), retryFailedDeploymentCount );
+ deploy( deployableArtifacts, repo, retryFailedDeploymentCount );
}
catch ( ArtifactDeployerException e )
{
Modified: maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deploy-pom/plugin-config.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deploy-pom/plugin-config.xml?rev=1709260&r1=1709259&r2=1709260&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deploy-pom/plugin-config.xml (original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deploy-pom/plugin-config.xml Sun Oct 18 11:07:33 2015
@@ -23,7 +23,6 @@ under the License.
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
- <localRepository>${localRepository}</localRepository>
<project implementation="org.apache.maven.plugin.deploy.stubs.MavenProjectStub">
<file>${basedir}/src/test/resources/unit/basic-deploy-pom/plugin-config.xml</file>
<packaging>pom</packaging>
Modified: maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deploy-scp/plugin-config.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deploy-scp/plugin-config.xml?rev=1709260&r1=1709259&r2=1709260&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deploy-scp/plugin-config.xml (original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deploy-scp/plugin-config.xml Sun Oct 18 11:07:33 2015
@@ -23,7 +23,6 @@ under the License.
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
- <localRepository>${localRepository}</localRepository>
<project implementation="org.apache.maven.plugin.deploy.stubs.MavenProjectStub">
<file>${basedir}/src/test/resources/unit/basic-deploy-scp/plugin-config.xml</file>
<packaging>jar</packaging>
Modified: maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deploy-test/plugin-config.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deploy-test/plugin-config.xml?rev=1709260&r1=1709259&r2=1709260&view=diff
==============================================================================
Binary files maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deploy-test/plugin-config.xml (original) and maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deploy-test/plugin-config.xml Sun Oct 18 11:07:33 2015 differ
Modified: maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deploy-with-attached-artifacts/plugin-config.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deploy-with-attached-artifacts/plugin-config.xml?rev=1709260&r1=1709259&r2=1709260&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deploy-with-attached-artifacts/plugin-config.xml (original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deploy-with-attached-artifacts/plugin-config.xml Sun Oct 18 11:07:33 2015
@@ -23,8 +23,7 @@ under the License.
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
- <localRepository>${localRepository}</localRepository>
- <project implementation="org.apache.maven.plugin.deploy.stubs.MavenProjectStub">
+ <project implementation="org.apache.maven.plugin.deploy.stubs.MavenProjectStub">
<file>${basedir}/src/test/resources/unit/basic-deploy-with-attached-artifacts/plugin-config.xml</file>
<packaging>jar</packaging>
<artifact implementation="org.apache.maven.plugin.deploy.stubs.DeployArtifactStub" />
Modified: maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/deploy-file-artifact-not-jar/plugin-config.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/deploy-file-artifact-not-jar/plugin-config.xml?rev=1709260&r1=1709259&r2=1709260&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/deploy-file-artifact-not-jar/plugin-config.xml (original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/deploy-file-artifact-not-jar/plugin-config.xml Sun Oct 18 11:07:33 2015
@@ -30,7 +30,6 @@ under the License.
<repositoryId>deploy-test</repositoryId>
<url>file://${basedir}/target/remote-repo/deploy-file-artifact-not-jar</url>
<uniqueVersion>true</uniqueVersion>
- <localRepository>${localRepository}</localRepository>
<repositoryLayout>default</repositoryLayout>
<generatePom>true</generatePom>
</configuration>
Modified: maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/deploy-file-classifier/plugin-config.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/deploy-file-classifier/plugin-config.xml?rev=1709260&r1=1709259&r2=1709260&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/deploy-file-classifier/plugin-config.xml (original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/deploy-file-classifier/plugin-config.xml Sun Oct 18 11:07:33 2015
@@ -31,7 +31,6 @@ under the License.
<repositoryId>deploy-test</repositoryId>
<url>file://${basedir}/target/remote-repo/deploy-file-classifier</url>
<uniqueVersion>true</uniqueVersion>
- <localRepository>${localRepository}</localRepository>
<classifier>bin</classifier>
<repositoryLayout>default</repositoryLayout>
<generatePom>true</generatePom>
Modified: maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/deploy-file-legacy-repository-layout/plugin-config.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/deploy-file-legacy-repository-layout/plugin-config.xml?rev=1709260&r1=1709259&r2=1709260&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/deploy-file-legacy-repository-layout/plugin-config.xml (original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/deploy-file-legacy-repository-layout/plugin-config.xml Sun Oct 18 11:07:33 2015
@@ -31,7 +31,6 @@ under the License.
<repositoryId>deploy-test</repositoryId>
<url>file://${basedir}/target/remote-repo/deploy-file-legacy-repository-layout</url>
<uniqueVersion>true</uniqueVersion>
- <localRepository>${localRepository}</localRepository>
<repositoryLayout>legacy</repositoryLayout>
<generatePom>true</generatePom>
</configuration>
Modified: maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/deploy-file-pom-file/plugin-config.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/deploy-file-pom-file/plugin-config.xml?rev=1709260&r1=1709259&r2=1709260&view=diff
==============================================================================
Binary files maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/deploy-file-pom-file/plugin-config.xml (original) and maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/deploy-file-pom-file/plugin-config.xml Sun Oct 18 11:07:33 2015 differ
Modified: maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/deploy-file-test/plugin-config.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/deploy-file-test/plugin-config.xml?rev=1709260&r1=1709259&r2=1709260&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/deploy-file-test/plugin-config.xml (original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/deploy-file-test/plugin-config.xml Sun Oct 18 11:07:33 2015
@@ -32,7 +32,6 @@ under the License.
<url>file://${basedir}/target/remote-repo/deploy-file-test</url>
<description>POM was created from deploy:deploy-file</description>
<uniqueVersion>true</uniqueVersion>
- <localRepository>${localRepository}</localRepository>
<repositoryLayout>default</repositoryLayout>
<generatePom>true</generatePom>
</configuration>