mirror of https://github.com/apache/maven.git
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:
parent
2425f945fb
commit
08ed903945
maven-core/src/main/java/org/apache/maven
|
@ -532,52 +532,64 @@ public class DefaultLifecycleExecutor
|
||||||
// if NEVER, don't blacklist
|
// if NEVER, don't blacklist
|
||||||
return false;
|
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();
|
if ( !LifecycleUtils.isValidPhaseName( task ) )
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MojoDescriptor mojo = null;
|
|
||||||
// definitely a CLI goal, can use prefix
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
mojo = getMojoDescriptorForDirectInvocation(
|
MojoDescriptor mojo = null;
|
||||||
task,
|
// definitely a CLI goal, can use prefix
|
||||||
session,
|
try
|
||||||
rootProject );
|
{
|
||||||
|
mojo = getMojoDescriptorForDirectInvocation(
|
||||||
|
task,
|
||||||
|
session,
|
||||||
|
rootProject );
|
||||||
|
|
||||||
return new TaskValidationResult();
|
return new TaskValidationResult();
|
||||||
}
|
}
|
||||||
catch ( PluginLoaderException e )
|
catch ( PluginLoaderException e )
|
||||||
{
|
{
|
||||||
// TODO: shouldn't hit this, investigate using the same resolution logic as
|
// TODO: shouldn't hit this, investigate using the same resolution logic as
|
||||||
// others for plugins in the reactor
|
// others for plugins in the reactor
|
||||||
|
|
||||||
return new TaskValidationResult( task, "Cannot find mojo descriptor for: \'" + task
|
return new TaskValidationResult(
|
||||||
+ "\' - Treating as non-aggregator." );
|
task,
|
||||||
}
|
"Cannot find mojo descriptor for: \'" + task
|
||||||
catch ( LifecycleSpecificationException e )
|
+ "\' - Treating as non-aggregator." );
|
||||||
{
|
}
|
||||||
String message =
|
catch ( LifecycleSpecificationException e )
|
||||||
"Invalid task '"
|
{
|
||||||
+ task
|
String message =
|
||||||
+ "': you must specify a valid lifecycle phase, or"
|
"Invalid task '"
|
||||||
+ " a goal in the format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersion:goal";
|
+ 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 )
|
catch ( LifecycleLoaderException e )
|
||||||
{
|
{
|
||||||
String message = "Cannot find plugin to match task '" + task + "'.";
|
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,
|
private List segmentTaskListByAggregationNeeds( final List tasks,
|
||||||
|
|
|
@ -355,11 +355,7 @@ public class PluginParameterExpressionEvaluator
|
||||||
|
|
||||||
if ( value == null )
|
if ( value == null )
|
||||||
{
|
{
|
||||||
// Check POM-level properties before we default over to system properties.
|
// The CLI should win for defining properties
|
||||||
if ( project != null && project.getProperties() != null )
|
|
||||||
{
|
|
||||||
value = project.getProperties().getProperty( expression );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( value == null && properties != null )
|
if ( value == null && properties != null )
|
||||||
{
|
{
|
||||||
|
@ -370,6 +366,12 @@ public class PluginParameterExpressionEvaluator
|
||||||
|
|
||||||
value = properties.getProperty( expression );
|
value = properties.getProperty( expression );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( value == null && ( project != null && project.getProperties() != null ) )
|
||||||
|
{
|
||||||
|
value = project.getProperties().getProperty( expression );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( value instanceof String )
|
if ( value instanceof String )
|
||||||
|
|
Loading…
Reference in New Issue