* @since 3.2.0
*/
public void executeMojo( MavenSession session, MavenProject project, MojoExecution execution )
throws Exception
{
SessionScope sessionScope = lookup( SessionScope.class );
try
{
sessionScope.enter();
sessionScope.seed( MavenSession.class, session );
MojoExecutionScope executionScope = lookup( MojoExecutionScope.class );
try
{
executionScope.enter();
executionScope.seed( MavenProject.class, project );
executionScope.seed( MojoExecution.class, execution );
Mojo mojo = lookupConfiguredMojo( session, execution );
mojo.execute();
MojoExecutionEvent event = new MojoExecutionEvent( session, project, execution, mojo );
for ( MojoExecutionListener listener : getContainer().lookupList( MojoExecutionListener.class ) )
{
listener.afterMojoExecutionSuccess( event );
}
}
finally
{
executionScope.exit();
}
}
finally
{
sessionScope.exit();
}
}