Add failure if artifact isn't a plugin.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163031 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Emmanuel Venisse 2004-09-05 19:03:41 +00:00
parent 2b4a352630
commit d4125cbafc
2 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,30 @@
package org.apache.maven.plugin.plugin;
import org.apache.maven.plugin.FailureResponse;
/**
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
* @version $Id$
*/
public class PluginFailureResponse
extends FailureResponse
{
private String LS = System.getProperty( "line.separator" );
private String message;
public PluginFailureResponse( Object o )
{
super( o );
}
public String shortMessage()
{
return (String) source;
}
public String longMessage()
{
return shortMessage();
}
}

View File

@ -50,6 +50,13 @@ public class PluginInstallMojo
ArtifactRepository localRepository = (ArtifactRepository) request.getParameter( "localRepository" );
if ( ! "plugin".equals( project.getType() ) )
{
response.setExecutionFailure( true, new PluginFailureResponse( "This project isn't a plugin." ) );
return;
}
Artifact artifact = new DefaultArtifact( project.getGroupId(),
project.getArtifactId(),
project.getVersion(),