diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java index a4c794ed21..ab16ddedd1 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java @@ -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, diff --git a/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java b/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java index 16a7817266..e47d04167b 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java @@ -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 )