mirror of
https://github.com/apache/maven.git
synced 2025-02-12 21:15:39 +00:00
some clean up
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163552 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9fb34fca1b
commit
ba06a10501
@ -1,27 +0,0 @@
|
|||||||
package org.apache.maven.artifact.handler;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @todo [BP] should be removed and replaced with scope if other design is approved
|
|
||||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
|
||||||
* @version $Id$
|
|
||||||
*/
|
|
||||||
public class TestHandler
|
|
||||||
extends AbstractArtifactHandler
|
|
||||||
{
|
|
||||||
}
|
|
@ -21,9 +21,9 @@
|
|||||||
import org.apache.maven.artifact.resolver.ArtifactResolver;
|
import org.apache.maven.artifact.resolver.ArtifactResolver;
|
||||||
import org.apache.maven.execution.MavenExecutionResponse;
|
import org.apache.maven.execution.MavenExecutionResponse;
|
||||||
import org.apache.maven.execution.MavenSession;
|
import org.apache.maven.execution.MavenSession;
|
||||||
|
import org.apache.maven.model.Goal;
|
||||||
import org.apache.maven.model.Plugin;
|
import org.apache.maven.model.Plugin;
|
||||||
import org.apache.maven.model.PluginManagement;
|
import org.apache.maven.model.PluginManagement;
|
||||||
import org.apache.maven.model.Goal;
|
|
||||||
import org.apache.maven.monitor.event.EventDispatcher;
|
import org.apache.maven.monitor.event.EventDispatcher;
|
||||||
import org.apache.maven.monitor.event.MavenEvents;
|
import org.apache.maven.monitor.event.MavenEvents;
|
||||||
import org.apache.maven.plugin.PluginExecutionResponse;
|
import org.apache.maven.plugin.PluginExecutionResponse;
|
||||||
@ -85,15 +85,10 @@ public MavenExecutionResponse execute( List tasks, MavenSession session )
|
|||||||
{
|
{
|
||||||
MavenProject project = session.getProject();
|
MavenProject project = session.getProject();
|
||||||
|
|
||||||
// TODO: should enrich this with the type artifactHandler, but for now just
|
|
||||||
// use "type" as is
|
|
||||||
ArtifactHandler artifactHandler = artifactHandlerManager.getArtifactHandler( project.getPackaging() );
|
ArtifactHandler artifactHandler = artifactHandlerManager.getArtifactHandler( project.getPackaging() );
|
||||||
|
|
||||||
if ( artifactHandler != null )
|
if ( artifactHandler != null )
|
||||||
{
|
{
|
||||||
// TODO: perhaps each type should define their own lifecycle
|
|
||||||
// completely, using the base as a default?
|
|
||||||
// If so, remove both of these goals from type artifactHandler
|
|
||||||
if ( artifactHandler.packageGoal() != null )
|
if ( artifactHandler.packageGoal() != null )
|
||||||
{
|
{
|
||||||
verifyMojoPhase( artifactHandler.packageGoal(), session );
|
verifyMojoPhase( artifactHandler.packageGoal(), session );
|
||||||
|
@ -211,9 +211,6 @@ public void verifyPlugin( String groupId, String artifactId, MavenSession sessio
|
|||||||
{
|
{
|
||||||
if ( !isPluginInstalled( groupId, artifactId ) )
|
if ( !isPluginInstalled( groupId, artifactId ) )
|
||||||
{
|
{
|
||||||
//!! This is entirely crappy. We need a better naming for plugin
|
|
||||||
// artifact ids and
|
|
||||||
|
|
||||||
ArtifactFactory artifactFactory = null;
|
ArtifactFactory artifactFactory = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -247,7 +244,7 @@ public void verifyPlugin( String groupId, String artifactId, MavenSession sessio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Default over to a sensible value (is 1.0-SNAPSHOT right?)
|
// TODO: Default over to a sensible value (is 1.0-SNAPSHOT right?) Hardcoging of group ID also
|
||||||
if ( StringUtils.isEmpty( version ) )
|
if ( StringUtils.isEmpty( version ) )
|
||||||
{
|
{
|
||||||
version = "1.0-SNAPSHOT";
|
version = "1.0-SNAPSHOT";
|
||||||
@ -337,7 +334,6 @@ public PluginExecutionResponse executeMojo( MavenSession session, String goalNam
|
|||||||
ArtifactResolver artifactResolver = null;
|
ArtifactResolver artifactResolver = null;
|
||||||
MavenProjectBuilder mavenProjectBuilder = null;
|
MavenProjectBuilder mavenProjectBuilder = null;
|
||||||
|
|
||||||
// TODO: should these be released
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
artifactResolver = (ArtifactResolver) container.lookup( ArtifactResolver.ROLE );
|
artifactResolver = (ArtifactResolver) container.lookup( ArtifactResolver.ROLE );
|
||||||
|
@ -55,15 +55,13 @@ public ComponentSetDescriptor createComponentDescriptors( Reader componentDescri
|
|||||||
{
|
{
|
||||||
PluginDescriptor pluginDescriptor;
|
PluginDescriptor pluginDescriptor;
|
||||||
|
|
||||||
//!! If there is a defective plugin installed should we halt everything or
|
|
||||||
// just not process that particular plugin
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pluginDescriptor = builder.build( componentDescriptorConfiguration );
|
pluginDescriptor = builder.build( componentDescriptorConfiguration );
|
||||||
}
|
}
|
||||||
catch ( Exception e )
|
catch ( Exception e )
|
||||||
{
|
{
|
||||||
|
// If the plugin is not valid, we cannot continue as it may make the lifecycle ebhave differently than expected
|
||||||
throw new Exception( "Cannot process plugin descriptor: " + source, e );
|
throw new Exception( "Cannot process plugin descriptor: " + source, e );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,71 +0,0 @@
|
|||||||
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 plugin:descriptor
|
|
||||||
* @prereq jar:jar
|
|
||||||
* @todo should be replaced by install:install
|
|
||||||
*/
|
|
||||||
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" );
|
|
||||||
|
|
||||||
if ( !"plugin".equals( project.getPackaging() ) )
|
|
||||||
{
|
|
||||||
response.setExecutionFailure( new PluginFailureResponse( "This project isn't a plugin." ) );
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Artifact artifact = new DefaultArtifact( project.getGroupId(), project.getArtifactId(), project.getVersion(),
|
|
||||||
project.getPackaging() );
|
|
||||||
|
|
||||||
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 );
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user