Author: bentmann
Date: Sun Dec 20 18:44:42 2009
New Revision: 892638
URL: http://svn.apache.org/viewvc?rev=892638&view=rev
Log:
o Decoupled from plexus
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
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=892638&r1=892637&r2=892638&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 Dec 20 18:44:42 2009
@@ -19,10 +19,14 @@
* under the License.
*/
+import java.util.Map;
+
import org.apache.maven.artifact.deployer.ArtifactDeployer;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
/**
@@ -44,6 +48,13 @@
protected ArtifactFactory artifactFactory;
/**
+ * Map that contains the layouts.
+ *
+ * @component
role="org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout"
+ */
+ private Map repositoryLayouts;
+
+ /**
* @parameter default-value="${localRepository}"
* @required
* @readonly
@@ -96,4 +107,17 @@
}
}
+ ArtifactRepositoryLayout getLayout( String id )
+ throws MojoExecutionException
+ {
+ ArtifactRepositoryLayout layout = (ArtifactRepositoryLayout)
repositoryLayouts.get( id );
+
+ if ( layout == null )
+ {
+ throw new MojoExecutionException( "Invalid repository layout: " +
id );
+ }
+
+ return layout;
+ }
+
}
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=892638&r1=892637&r2=892638&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 Dec 20 18:44:42 2009
@@ -45,7 +45,6 @@
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
-import java.util.Map;
/**
* Installs the artifact in the remote repository.
@@ -119,13 +118,6 @@
private String repositoryLayout;
/**
- * Map that contains the layouts
- *
- * @component
role="org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout"
- */
- private Map repositoryLayouts;
-
- /**
* URL where the artifact will be deployed. <br/>
* ie ( file://C:\m2-repo or scp://host.com/path/to/repo )
*
@@ -206,9 +198,7 @@
throw new MojoExecutionException( file.getPath() + " not found." );
}
- ArtifactRepositoryLayout layout;
-
- layout = ( ArtifactRepositoryLayout ) repositoryLayouts.get(
repositoryLayout );
+ ArtifactRepositoryLayout layout = getLayout( repositoryLayout );
ArtifactRepository deploymentRepository =
repositoryFactory.createDeploymentArtifactRepository(
repositoryId, url, layout, uniqueVersion );
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=892638&r1=892637&r2=892638&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 Dec 20 18:44:42 2009
@@ -29,12 +29,6 @@
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.artifact.ProjectArtifactMetadata;
-import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusContainer;
-import
org.codehaus.plexus.component.repository.exception.ComponentLookupException;
-import org.codehaus.plexus.context.Context;
-import org.codehaus.plexus.context.ContextException;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
import java.io.File;
import java.util.Iterator;
@@ -53,7 +47,6 @@
*/
public class DeployMojo
extends AbstractDeployMojo
- implements Contextualizable
{
private static final Pattern ALT_REPO_SYNTAX_PATTERN = Pattern.compile(
"(.+)::(.+)::(.+)" );
@@ -102,11 +95,6 @@
* @readonly
*/
private List attachedArtifacts;
-
- /**
- * Contextualized.
- */
- private PlexusContainer container;
/**
* Set this to 'true' to bypass artifact deploy
@@ -224,16 +212,8 @@
String id = matcher.group( 1 ).trim();
String layout = matcher.group( 2 ).trim();
String url = matcher.group( 3 ).trim();
-
- ArtifactRepositoryLayout repoLayout;
- try
- {
- repoLayout = ( ArtifactRepositoryLayout )
container.lookup( ArtifactRepositoryLayout.ROLE, layout );
- }
- catch ( ComponentLookupException e )
- {
- throw new MojoExecutionException( "Cannot find repository
layout: " + layout, e );
- }
+
+ ArtifactRepositoryLayout repoLayout = getLayout( layout );
repo = new DefaultArtifactRepository( id, url, repoLayout );
}
@@ -255,9 +235,4 @@
return repo;
}
- public void contextualize( Context context )
- throws ContextException
- {
- this.container = (PlexusContainer) context.get(
PlexusConstants.PLEXUS_KEY );
- }
}