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

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

Introduction

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

Prototype

String MAKE_MODE

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

Click Source Link

Usage

From source file:org.jetbrains.idea.maven.server.Maven30ServerEmbedderImpl.java

License:Apache License

private MavenExecutionResult doExecute(@Nonnull final File file, @Nonnull final List<String> activeProfiles,
        @Nonnull final List<String> inactiveProfiles, @Nonnull final List<String> goals,
        @Nonnull final List<String> selectedProjects, boolean alsoMake, boolean alsoMakeDependents)
        throws RemoteException {
    MavenExecutionRequest request = createRequest(file, activeProfiles, inactiveProfiles, goals);

    if (!selectedProjects.isEmpty()) {
        request.setRecursive(true);//from   w  w  w. j ava  2 s  . c om
        request.setSelectedProjects(selectedProjects);
        if (alsoMake && alsoMakeDependents) {
            request.setMakeBehavior(ReactorManager.MAKE_BOTH_MODE);
        } else if (alsoMake) {
            request.setMakeBehavior(ReactorManager.MAKE_MODE);
        } else if (alsoMakeDependents) {
            request.setMakeBehavior(ReactorManager.MAKE_DEPENDENTS_MODE);
        }
    }

    org.apache.maven.execution.MavenExecutionResult executionResult = safeExecute(request,
            getComponent(Maven.class));

    return new MavenExecutionResult(executionResult.getProject(),
            filterExceptions(executionResult.getExceptions()));
}

From source file:org.jetbrains.maven.embedder.MavenEmbedder.java

License:Apache License

@Nonnull
public MavenExecutionResult execute(@Nonnull final File file, @Nonnull final List<String> activeProfiles,
        @Nonnull final List<String> inactiveProfiles, @Nonnull final List<String> goals,
        @Nonnull final List<String> selectedProjects, boolean alsoMake, boolean alsoMakeDependents) {
    try {/*from  w  w  w.j a  va  2  s.  c  o m*/
        MavenExecutionRequest request = createRequest(file, activeProfiles, inactiveProfiles, goals);

        if (!selectedProjects.isEmpty()) {
            request.setRecursive(true);
            request.setSelectedProjects(selectedProjects);
            if (alsoMake && alsoMakeDependents) {
                request.setMakeBehavior(ReactorManager.MAKE_BOTH_MODE);
            } else if (alsoMake) {
                request.setMakeBehavior(ReactorManager.MAKE_MODE);
            } else if (alsoMakeDependents) {
                request.setMakeBehavior(ReactorManager.MAKE_DEPENDENTS_MODE);
            }
        }

        Maven maven = getComponent(Maven.class);
        Method method = maven.getClass().getDeclaredMethod("doExecute", MavenExecutionRequest.class,
                EventDispatcher.class);
        method.setAccessible(true);
        ReactorManager reactor = (ReactorManager) method.invoke(maven, request, request.getEventDispatcher());
        return new MavenExecutionResult(reactor.getTopLevelProject(), Collections.<Exception>emptyList());
    } catch (InvocationTargetException e) {
        return handleException(e.getTargetException());
    } catch (NoSuchMethodException e) {
        throw new RuntimeException(e); // should never happen
    } catch (IllegalAccessException e) {
        throw new RuntimeException(e); // should never happen
    }
}