o adding plugin install

this is not the way i want the installing mechanism to work (i.e. copying
  the same class around ...) but folks want to install plugins so i'll just
  pop this in for now.


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@162997 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2004-08-23 00:27:44 +00:00
parent 5d89d4b2c2
commit c86ea920b8
2 changed files with 88 additions and 0 deletions

View File

@ -20,5 +20,25 @@
<artifactId>maven-plugin-tools</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>maven</groupId>
<artifactId>maven-model</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>maven</groupId>
<artifactId>maven-core</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>maven</groupId>
<artifactId>wagon-api</artifactId>
<version>1.0-alpha-1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,68 @@
package org.apache.maven.plugin.plugin;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DefaultArtifact;
import org.apache.maven.artifact.installer.ArtifactInstaller;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.plugin.AbstractPlugin;
import org.apache.maven.plugin.PluginExecutionRequest;
import org.apache.maven.plugin.PluginExecutionResponse;
import org.apache.maven.project.MavenProject;
/**
* @goal install
*
* @description installs project's main artifact in local repository
*
* @parameter name="project"
* type="org.apache.maven.project.MavenProject"
* required="true"
* validator=""
* expression="#project"
* description=""
* @parameter name="installer"
* type="org.apache.maven.artifact.installer.ArtifactInstaller"
* required="true"
* validator=""
* expression="#component.org.apache.maven.artifact.installer.ArtifactInstaller"
* description=""
* @parameter name="localRepository"
* type="org.apache.maven.artifact.repository.ArtifactRepository"
* required="true"
* validator=""
* expression="#localRepository"
* description=""
* @prereq jar:jar
*/
public class PluginInstallMojo
extends AbstractPlugin
{
public void execute( PluginExecutionRequest request, PluginExecutionResponse response )
throws Exception
{
MavenProject project = (MavenProject) request.getParameter( "project" );
ArtifactInstaller artifactInstaller = (ArtifactInstaller) request.getParameter( "installer" );
ArtifactRepository localRepository = (ArtifactRepository) request.getParameter( "localRepository" );
Artifact artifact = new DefaultArtifact( project.getGroupId(),
project.getArtifactId(),
project.getVersion(),
project.getType() );
artifactInstaller.install( project.getBuild().getDirectory(), artifact, localRepository );
// ----------------------------------------------------------------------
// This is not the way to do this, but in order to get the integration
// tests working this is what I'm doing. jvz.
// ----------------------------------------------------------------------
Artifact pomArtifact = new DefaultArtifact( project.getGroupId(),
project.getArtifactId(),
project.getVersion(),
"pom" );
artifactInstaller.install( project.getFile(), pomArtifact, localRepository );
}
}