o Fail properly when mojo requires project but there is none

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@808819 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-08-28 08:55:27 +00:00
parent 6da9bf5c0a
commit b2e6f787f6
1 changed files with 7 additions and 1 deletions

View File

@ -417,11 +417,17 @@ public class DefaultLifecycleExecutor
{ {
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor(); MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
if ( mojoDescriptor.isProjectRequired() && !session.isUsingPOMsFromFilesystem() )
{
throw new MojoExecutionException( "Goal " + mojoDescriptor.getId()
+ " requires a project to execute but there is no POM in this build." );
}
if ( mojoDescriptor.isOnlineRequired() && session.isOffline() ) if ( mojoDescriptor.isOnlineRequired() && session.isOffline() )
{ {
if ( MojoExecution.Source.CLI.equals( mojoExecution.getSource() ) ) if ( MojoExecution.Source.CLI.equals( mojoExecution.getSource() ) )
{ {
throw new MojoExecutionException( "Goal " + mojoDescriptor.getGoal() throw new MojoExecutionException( "Goal " + mojoDescriptor.getId()
+ " requires online mode for execution but Maven is currently offline." ); + " requires online mode for execution but Maven is currently offline." );
} }
else else