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

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

Introduction

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

Prototype

public void setFailureBehavior(String failureBehavior) 

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);
    }/*from  w ww .j a  va 2s .co  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());
}