private MavenExecutionResult doExecute(
      @NotNull final File file,
      @NotNull final List<String> activeProfiles,
      @NotNull final List<String> inactiveProfiles,
      @NotNull final List<String> goals,
      @NotNull final List<String> selectedProjects,
      boolean alsoMake,
      boolean alsoMakeDependents)
      throws RemoteException {
    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);
    org.apache.maven.execution.MavenExecutionResult executionResult = maven.execute(request);

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