mirror of https://github.com/apache/maven.git
Improve diagnosis when no goals are passed in via the request (the goals List is null, not just empty). This can happen when used via the embedder in a non-cli scenario.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@614319 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
77352f07f7
commit
8b762300ef
|
@ -181,23 +181,26 @@ public class DefaultMaven
|
|||
reactorManager,
|
||||
dispatcher );
|
||||
|
||||
for ( Iterator i = request.getGoals().iterator(); i.hasNext(); )
|
||||
if ( request.getGoals() != null )
|
||||
{
|
||||
String goal = (String) i.next();
|
||||
|
||||
if ( goal == null )
|
||||
for ( Iterator i = request.getGoals().iterator(); i.hasNext(); )
|
||||
{
|
||||
i.remove();
|
||||
continue;
|
||||
}
|
||||
String goal = (String) i.next();
|
||||
|
||||
TaskValidationResult tvr = lifecycleExecutor.isTaskValid( goal, session, reactorManager.getTopLevelProject() );
|
||||
if ( goal == null )
|
||||
{
|
||||
i.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !tvr.isTaskValid() )
|
||||
{
|
||||
result.addException( tvr.generateInvalidTaskException() );
|
||||
TaskValidationResult tvr = lifecycleExecutor.isTaskValid( goal, session, reactorManager.getTopLevelProject() );
|
||||
|
||||
return result;
|
||||
if ( !tvr.isTaskValid() )
|
||||
{
|
||||
result.addException( tvr.generateInvalidTaskException() );
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ public class DefaultLifecycleExecutor
|
|||
|
||||
List goals = session.getGoals();
|
||||
|
||||
if ( goals.isEmpty() && ( rootProject != null ) )
|
||||
if ( ( ( goals == null ) || goals.isEmpty() ) && ( rootProject != null ) )
|
||||
{
|
||||
String goal = rootProject.getDefaultGoal();
|
||||
|
||||
|
@ -119,7 +119,7 @@ public class DefaultLifecycleExecutor
|
|||
}
|
||||
}
|
||||
|
||||
if ( goals.isEmpty() )
|
||||
if ( ( goals == null ) || goals.isEmpty() )
|
||||
{
|
||||
throw new NoGoalsSpecifiedException( "\n\nYou must specify at least one goal. Try 'install' to build or mvn -? for other options.\n See http://maven.apache.org for more information.\n\n" );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue