Example usage for org.apache.maven.execution ReactorManager FAIL_FAST

List of usage examples for org.apache.maven.execution ReactorManager FAIL_FAST

Introduction

In this page you can find the example usage for org.apache.maven.execution ReactorManager FAIL_FAST.

Prototype

String FAIL_FAST

To view the source code for org.apache.maven.execution ReactorManager FAIL_FAST.

Click Source Link

Usage

From source file:org.nuxeo.build.maven.MavenEmbedder.java

License:Open Source License

public void execute(List<MavenProject> projects, List<?> goals, EventMonitor eventMonitor,
        TransferListener transferListener, Properties properties, File executionRootDirectory)
        throws CycleDetectedException, LifecycleExecutionException, BuildFailureException,
        DuplicateProjectException, MissingProjectException {
    ReactorManager rm = new ReactorManager(projects);

    EventDispatcher eventDispatcher = new DefaultEventDispatcher();

    eventDispatcher.addEventMonitor(eventMonitor);

    // If this option is set the exception seems to be hidden ...

    // rm.setFailureBehavior( ReactorManager.FAIL_AT_END );

    rm.setFailureBehavior(ReactorManager.FAIL_FAST);

    MavenSession session = new MavenSession(embedder.getContainer(), settings, localRepository, eventDispatcher,
            rm, goals, executionRootDirectory.getAbsolutePath(), properties, new Date());

    session.setUsingPOMsFromFilesystem(true);

    if (transferListener != null) {
        wagonManager.setDownloadMonitor(transferListener);
    }//w w  w .  j a v a 2 s  .c  o m

    // ----------------------------------------------------------------------
    // Maven should not be using system properties internally but because
    // it does for now I'll just take properties that are handed to me
    // and set them so that the plugin expression evaluator will work
    // as expected.
    // ----------------------------------------------------------------------

    if (properties != null) {
        for (Iterator<?> i = properties.keySet().iterator(); i.hasNext();) {
            String key = (String) i.next();

            String value = properties.getProperty(key);

            System.setProperty(key, value);
        }
    }

    lifecycleExecutor.execute(session, rm, session.getEventDispatcher());
}