o Fixed functionality to disable dependency resolution and download for things like clean:clean.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163138 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2004-09-22 03:31:41 +00:00
parent 5f23120ff6
commit 8e6c7b0424
3 changed files with 47 additions and 24 deletions

View File

@ -29,6 +29,8 @@ public class MavenGoalExecutionContext
private String goalName;
private boolean requiresDependencies;
public MavenGoalExecutionContext( MavenSession session, String goalName )
{
this.session = session;
@ -138,4 +140,15 @@ public class MavenGoalExecutionContext
{
this.goalName = goalName;
}
public void requiresDependencies( boolean requiresDependencies )
{
this.requiresDependencies = requiresDependencies;
}
public boolean requiresDependencies()
{
return requiresDependencies;
}
}

View File

@ -35,6 +35,8 @@ public class DependencyDownloadPhase
{
public void execute( MavenGoalExecutionContext context )
throws GoalExecutionException
{
if(context.requiresDependencies())
{
ArtifactResolver artifactResolver = null;
@ -66,4 +68,5 @@ public class DependencyDownloadPhase
context.release( artifactResolver );
}
}
}
}

View File

@ -37,12 +37,17 @@ public class DependencyResolutionPhase
public void execute( MavenGoalExecutionContext context )
throws GoalExecutionException
{
boolean requiresDependencies = false;
for ( Iterator iterator = context.getResolvedGoals().iterator(); iterator.hasNext(); )
{
String goalName = (String) iterator.next();
if ( context.getMojoDescriptor( goalName ).requiresDependencyResolution() )
MojoDescriptor mojoDescriptor = context.getMojoDescriptor(goalName);
if ( mojoDescriptor.requiresDependencyResolution() )
{
requiresDependencies = true;
try
{
resolveTransitiveDependencies( context );
@ -55,6 +60,8 @@ public class DependencyResolutionPhase
break;
}
}
context.requiresDependencies(requiresDependencies);
}
private void resolveTransitiveDependencies( MavenGoalExecutionContext context )