added generic install plugin. I am not sure if this is a right way of implementing this - but I will need similar things for site plugin - so this will serve as an example for disussion how to attain arbitrary goal(s) from plugin

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@162822 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michal Maczka 2004-06-20 15:56:57 +00:00
parent 93c196e590
commit c0000822c0
3 changed files with 99 additions and 0 deletions

View File

@ -0,0 +1,7 @@
*~
*.log
target
.classpath
.project
*.ipr
*.iws

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<project>
<parent>
<groupId>maven</groupId>
<artifactId>maven-plugin-parent</artifactId>
<version>2.0-SNAPSHOT</version>
</parent>
<groupId>maven-install-plugin</groupId>
<artifactId>maven-install-plugin</artifactId>
<name>Maven Install Plugin</name>
<currentVersion>1.0-SNAPSHOT</currentVersion>
<inceptionYear>2004</inceptionYear>
<package>org.apache.maven.plugin.install</package>
</project>

View File

@ -0,0 +1,77 @@
package org.apache.maven.plugin.clean;
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.apache.maven.plugin.AbstractPlugin;
import org.apache.maven.plugin.PluginExecutionRequest;
import org.apache.maven.plugin.PluginExecutionResponse;
import org.apache.maven.project.MavenProject;
import org.apache.maven.MavenCore;
import java.util.ArrayList;
import java.util.List;
/**
* @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="mavenCore"
* type="org.apache.maven.MavenCore"
* required="true"
* validator=""
* expression="#component.org.apache.maven.artifact.deployer.ArtifactDeployer"
* description=""""
*
* @author <a href="mailto:michal@codehaus.org">Michal Maczka</a>
* @version $Id$
*/
public class InstallMojo
extends AbstractPlugin
{
public void execute( PluginExecutionRequest request, PluginExecutionResponse response )
throws Exception
{
MavenProject project = (MavenProject) request.getParameter( "project" );
String type = project.getType();
MavenCore mavenCore = ( MavenCore ) request.getParameter( "mavenCore" );
String goal = type + ":" + type;
List goals = new ArrayList( 1 );
goals.add( goal );
mavenCore.execute( project, goals );
}
}