@SuppressWarnings( { "ThrowableInstanceNeverThrown" } )
private void execute( MavenSession session, MojoExecution mojoExecution, ProjectIndex projectIndex,
DependencyContext dependencyContext )
throws LifecycleExecutionException
{
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
try
{
mavenPluginManager.checkRequiredMavenVersion( mojoDescriptor.getPluginDescriptor() );
}
catch ( PluginIncompatibleException e )
{
throw new LifecycleExecutionException( mojoExecution, session.getCurrentProject(), e );
}
if ( mojoDescriptor.isProjectRequired() && !session.isUsingPOMsFromFilesystem() )
{
Throwable cause =
new MissingProjectException( "Goal requires a project to execute"
+ " but there is no POM in this directory (" + session.getExecutionRootDirectory() + ")."
+ " Please verify you invoked Maven from the correct directory." );
throw new LifecycleExecutionException( mojoExecution, null, cause );
}
if ( mojoDescriptor.isOnlineRequired() && session.isOffline() )
{
if ( MojoExecution.Source.CLI.equals( mojoExecution.getSource() ) )
{
Throwable cause =
new IllegalStateException( "Goal requires online mode for execution"