some better error reporting for goals that are not found

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163391 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-02-24 00:49:40 +00:00
parent 1055b6493c
commit 423d6ab68d
2 changed files with 7 additions and 18 deletions

View File

@ -133,10 +133,15 @@ public class DefaultLifecycleExecutor
} }
catch ( Exception e ) catch ( Exception e )
{ {
e.printStackTrace(); throw new LifecycleExecutionException( "Problem getting plugin for " + id, e );
} }
MojoDescriptor mojoDescriptor = pluginManager.getMojoDescriptor( id ); MojoDescriptor mojoDescriptor = pluginManager.getMojoDescriptor( id );
if ( mojoDescriptor == null )
{
// TODO: goal not found exception?
throw new LifecycleExecutionException( "Goal not found: " + id );
}
if ( mojoDescriptor.requiresDependencyResolution() ) if ( mojoDescriptor.requiresDependencyResolution() )
{ {

View File

@ -25,15 +25,14 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.ArtifactResolver; import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
import org.apache.maven.artifact.resolver.filter.ExclusionSetFilter; import org.apache.maven.artifact.resolver.filter.ExclusionSetFilter;
import org.apache.maven.lifecycle.goal.GoalExecutionException;
import org.apache.maven.execution.MavenSession; import org.apache.maven.execution.MavenSession;
import org.apache.maven.lifecycle.goal.GoalExecutionException;
import org.apache.maven.plugin.descriptor.MojoDescriptor; import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.Parameter; import org.apache.maven.plugin.descriptor.Parameter;
import org.apache.maven.plugin.descriptor.PluginDescriptor; import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder; import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder;
import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectBuilder; import org.apache.maven.project.MavenProjectBuilder;
import org.apache.maven.execution.MavenSession;
import org.codehaus.plexus.ArtifactEnabledContainer; import org.codehaus.plexus.ArtifactEnabledContainer;
import org.codehaus.plexus.PlexusConstants; import org.codehaus.plexus.PlexusConstants;
import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.PlexusContainer;
@ -203,21 +202,6 @@ public class DefaultPluginManager
Artifact pluginArtifact = new DefaultArtifact( "maven", artifactId, version, "plugin", "jar" ); Artifact pluginArtifact = new DefaultArtifact( "maven", artifactId, version, "plugin", "jar" );
addPlugin( pluginArtifact, session ); addPlugin( pluginArtifact, session );
// Now, we need to resolve the plugins for this goal's prereqs.
MojoDescriptor mojoDescriptor = getMojoDescriptor( goalName );
List prereqs = mojoDescriptor.getPrereqs();
if ( prereqs != null )
{
for ( Iterator it = prereqs.iterator(); it.hasNext(); )
{
String prereq = (String) it.next();
verifyPluginForGoal( prereq, session );
}
}
} }
} }