org.apache.maven.lifecycle.internal.ReactorBuildStatus Java Examples

The following examples show how to use org.apache.maven.lifecycle.internal.ReactorBuildStatus. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GenerateBomMojo.java    From sundrio with Apache License 2.0 5 votes vote down vote up
private void build(MavenSession session, MavenProject project, List<MavenProject> allProjects, GoalSet goals) throws MojoExecutionException {
    session.setProjects(allProjects);
    ProjectIndex projectIndex = new ProjectIndex(session.getProjects());
    try {
        ReactorBuildStatus reactorBuildStatus = new ReactorBuildStatus(new BomDependencyGraph(session.getProjects()));
        ReactorContext reactorContext = new ReactorContextFactory(new MavenVersion(mavenVersion)).create(session.getResult(), projectIndex, Thread.currentThread().getContextClassLoader(),
                reactorBuildStatus, builder);
        List<TaskSegment> segments = segmentCalculator.calculateTaskSegments(session);
        for (TaskSegment segment : segments) {
            builder.buildProject(session, reactorContext, project, filterSegment(segment, goals));
        }
    } catch (Throwable t) {
        throw new MojoExecutionException("Error building generated bom:" + project.getArtifactId(), t);
    }
}
 
Example #2
Source File: ReactorContextFactory.java    From sundrio with Apache License 2.0 5 votes vote down vote up
public ReactorContext create(MavenExecutionResult result, ProjectIndex index, ClassLoader classLoader, ReactorBuildStatus status, LifecycleModuleBuilder builder) {
    ReactorContext context;
    if (VERSION_3_0_0.compareTo(version) < 0) {
        throw new UnsupportedOperationException("ReactorContext is not supported in maven version:" + version);
    } else if (VERSION_3_3_0.compareTo(version) < 0) {
        context = create_3_2_x(result, index, classLoader, status);
    } else {
        context = create_3_3_x(result, index, classLoader, status, builder);
    }

    if (context == null) {
        throw new IllegalStateException("Unable to create ReactorContext");
    }
    return context;
}
 
Example #3
Source File: ReactorContextFactory.java    From sundrio with Apache License 2.0 5 votes vote down vote up
private static ReactorContext create_3_2_x(MavenExecutionResult result, ProjectIndex index, ClassLoader classLoader, ReactorBuildStatus status) {
    try {
        Constructor<ReactorContext> constructor = ReactorContext.class.getDeclaredConstructor(MavenExecutionResult.class, ProjectIndex.class, ClassLoader.class, ReactorBuildStatus.class);
        return constructor.newInstance(result, index, classLoader, status);
    } catch (NoSuchMethodException e) {
        return null;
    } catch (Throwable t) {
        throw new RuntimeException("Could not create ReactorContext.", t);
    }
}
 
Example #4
Source File: ReactorContextFactory.java    From sundrio with Apache License 2.0 5 votes vote down vote up
private static ReactorContext create_3_3_x(MavenExecutionResult result, ProjectIndex index, ClassLoader classLoader, ReactorBuildStatus status, LifecycleModuleBuilder builder) {
    try {
        Constructor<ReactorContext> constructor = (Constructor<ReactorContext>) ReactorContext.class.getDeclaredConstructors()[0];
        return constructor.newInstance(result, index, classLoader, status, Reflections.getMemento(builder));
    } catch (Throwable t) {
        throw new RuntimeException("Could not create ReactorContext.", t);
    }
}