class LifecycleModuleBuilder {

    private final MojoExecutor mojoExecutor;
    private final BuilderCommon builderCommon;
    private final ExecutionEventCatapult eventCatapult;
    private final ProjectExecutionListener projectExecutionListener;
    private final ConsumerPomArtifactTransformer consumerPomArtifactTransformer;

    @Inject
    public LifecycleModuleBuilder(
            MojoExecutor mojoExecutor,
            BuilderCommon builderCommon,
            ExecutionEventCatapult eventCatapult,
            List<ProjectExecutionListener> listeners,
            ConsumerPomArtifactTransformer consumerPomArtifactTransformer) {
        this.mojoExecutor = mojoExecutor;
        this.builderCommon = builderCommon;
        this.eventCatapult = eventCatapult;
        this.projectExecutionListener = new CompoundProjectExecutionListener(listeners);
        this.consumerPomArtifactTransformer = consumerPomArtifactTransformer;
    }

    public void buildProject(
            MavenSession session, ReactorContext reactorContext, MavenProject currentProject, TaskSegment taskSegment) {
        buildProject(session, session, reactorContext, currentProject, taskSegment);
    }

    public void buildProject(
            MavenSession session,
            MavenSession rootSession,
            ReactorContext reactorContext,
            MavenProject currentProject,
            TaskSegment taskSegment) {<FILL_FUNCTION_BODY>}
}

        session.setCurrentProject(currentProject);

        long buildStartTime = System.currentTimeMillis();

        try {

            if (reactorContext.getReactorBuildStatus().isHaltedOrBlacklisted(currentProject)) {
                eventCatapult.fire(ExecutionEvent.Type.ProjectSkipped, session, null);
                return;
            }

            consumerPomArtifactTransformer.injectTransformedArtifacts(session.getRepositorySession(), currentProject);

            BuilderCommon.attachToThread(currentProject);

            projectExecutionListener.beforeProjectExecution(new ProjectExecutionEvent(session, currentProject));

            eventCatapult.fire(ExecutionEvent.Type.ProjectStarted, session, null);

            MavenExecutionPlan executionPlan =
                    builderCommon.resolveBuildPlan(session, currentProject, taskSegment, new HashSet<>());
            List<MojoExecution> mojoExecutions = executionPlan.getMojoExecutions();

            projectExecutionListener.beforeProjectLifecycleExecution(
                    new ProjectExecutionEvent(session, currentProject, mojoExecutions));
            mojoExecutor.execute(session, mojoExecutions);

            long buildEndTime = System.currentTimeMillis();

            projectExecutionListener.afterProjectExecutionSuccess(
                    new ProjectExecutionEvent(session, currentProject, mojoExecutions));

            reactorContext.getResult().addBuildSummary(new BuildSuccess(currentProject, buildEndTime - buildStartTime));

            eventCatapult.fire(ExecutionEvent.Type.ProjectSucceeded, session, null);
        } catch (Throwable t) {
            builderCommon.handleBuildError(reactorContext, rootSession, session, currentProject, t, buildStartTime);

            projectExecutionListener.afterProjectExecutionFailure(
                    new ProjectExecutionEvent(session, currentProject, t));

            // rethrow original errors and runtime exceptions
            if (t instanceof RuntimeException) {
                throw (RuntimeException) t;
            }
            if (t instanceof Error) {
                throw (Error) t;
            }
        } finally {
            session.setCurrentProject(null);

            Thread.currentThread().setContextClassLoader(reactorContext.getOriginalContextClassLoader());
        }
    
<no_super_class>