Example usage for org.apache.maven.lifecycle.internal LifecycleExecutionPlanCalculator setupMojoExecution

List of usage examples for org.apache.maven.lifecycle.internal LifecycleExecutionPlanCalculator setupMojoExecution

Introduction

In this page you can find the example usage for org.apache.maven.lifecycle.internal LifecycleExecutionPlanCalculator setupMojoExecution.

Prototype

void setupMojoExecution(MavenSession session, MavenProject project, MojoExecution mojoExecution)
            throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
            MojoNotFoundException, InvalidPluginDescriptorException, NoPluginFoundForPrefixException,
            LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException;

Source Link

Usage

From source file:org.eclipse.m2e.core.internal.embedder.MavenImpl.java

License:Open Source License

@SuppressWarnings("deprecation")
public MojoExecution setupMojoExecution(MavenSession session, MavenProject project, MojoExecution execution)
        throws CoreException {
    MojoExecution clone = new MojoExecution(execution.getPlugin(), execution.getGoal(),
            execution.getExecutionId());
    clone.setMojoDescriptor(execution.getMojoDescriptor());
    if (execution.getConfiguration() != null) {
        clone.setConfiguration(new Xpp3Dom(execution.getConfiguration()));
    }/*from   ww w  . j  a v  a2  s . c o m*/
    clone.setLifecyclePhase(execution.getLifecyclePhase());
    LifecycleExecutionPlanCalculator executionPlanCalculator = lookup(LifecycleExecutionPlanCalculator.class);
    try {
        executionPlanCalculator.setupMojoExecution(session, project, clone);
    } catch (Exception ex) {
        throw new CoreException(new Status(IStatus.ERROR, IMavenConstants.PLUGIN_ID, -1,
                NLS.bind(Messages.MavenImpl_error_calc_build_plan, ex.getMessage()), ex));
    }
    return clone;
}