MNG-1922: Making sure that CLI properties are processed first

o fixing IT0039


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@572229 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2007-09-03 03:56:31 +00:00
parent 2425f945fb
commit 08ed903945
2 changed files with 55 additions and 41 deletions

View File

@ -533,13 +533,16 @@ public class DefaultLifecycleExecutor
return false;
}
public TaskValidationResult isTaskValid( String task, MavenSession session, MavenProject rootProject )
public TaskValidationResult isTaskValid( String task,
MavenSession session,
MavenProject rootProject )
{
if ( LifecycleUtils.isValidPhaseName( task ) )
//jvz: have to investigate plugins that are run without a root project or using Maven in reactor mode. Looks like we
// were never validating these anyway if you look in the execution code.
if ( rootProject != null )
{
return new TaskValidationResult();
}
else
if ( !LifecycleUtils.isValidPhaseName( task ) )
{
MojoDescriptor mojo = null;
// definitely a CLI goal, can use prefix
@ -557,7 +560,9 @@ public class DefaultLifecycleExecutor
// TODO: shouldn't hit this, investigate using the same resolution logic as
// others for plugins in the reactor
return new TaskValidationResult( task, "Cannot find mojo descriptor for: \'" + task
return new TaskValidationResult(
task,
"Cannot find mojo descriptor for: \'" + task
+ "\' - Treating as non-aggregator." );
}
catch ( LifecycleSpecificationException e )
@ -568,18 +573,25 @@ public class DefaultLifecycleExecutor
+ "': you must specify a valid lifecycle phase, or"
+ " a goal in the format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersion:goal";
return new TaskValidationResult( task, message );
return new TaskValidationResult(
task,
message );
}
catch ( LifecycleLoaderException e )
{
String message = "Cannot find plugin to match task '" + task + "'.";
return new TaskValidationResult( task, message );
return new TaskValidationResult(
task,
message );
}
}
}
return new TaskValidationResult();
}
private List segmentTaskListByAggregationNeeds( final List tasks,
final MavenSession session,
final MavenProject rootProject )

View File

@ -355,11 +355,7 @@ public class PluginParameterExpressionEvaluator
if ( value == null )
{
// Check POM-level properties before we default over to system properties.
if ( project != null && project.getProperties() != null )
{
value = project.getProperties().getProperty( expression );
}
// The CLI should win for defining properties
if ( value == null && properties != null )
{
@ -370,6 +366,12 @@ public class PluginParameterExpressionEvaluator
value = properties.getProperty( expression );
}
if ( value == null && ( project != null && project.getProperties() != null ) )
{
value = project.getProperties().getProperty( expression );
}
}
if ( value instanceof String )