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

@ -532,52 +532,64 @@ public class DefaultLifecycleExecutor
// if NEVER, don't blacklist
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
{
MojoDescriptor mojo = null;
// definitely a CLI goal, can use prefix
try
if ( !LifecycleUtils.isValidPhaseName( task ) )
{
mojo = getMojoDescriptorForDirectInvocation(
task,
session,
rootProject );
MojoDescriptor mojo = null;
// definitely a CLI goal, can use prefix
try
{
mojo = getMojoDescriptorForDirectInvocation(
task,
session,
rootProject );
return new TaskValidationResult();
}
catch ( PluginLoaderException e )
{
// TODO: shouldn't hit this, investigate using the same resolution logic as
// others for plugins in the reactor
return new TaskValidationResult();
}
catch ( PluginLoaderException e )
{
// 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
+ "\' - Treating as non-aggregator." );
}
catch ( LifecycleSpecificationException e )
{
String message =
"Invalid task '"
+ task
+ "': you must specify a valid lifecycle phase, or"
+ " a goal in the format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersion:goal";
return new TaskValidationResult(
task,
"Cannot find mojo descriptor for: \'" + task
+ "\' - Treating as non-aggregator." );
}
catch ( LifecycleSpecificationException e )
{
String message =
"Invalid task '"
+ task
+ "': 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 + "'.";
}
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,

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 )