public MavenExecutionResult executeWithMavenSession(@NotNull MavenExecutionRequest request,
                                                      @NotNull MavenWorkspaceMap workspaceMap,
                                                      @Nullable MavenServerConsoleIndicatorImpl indicator,
                                                      Consumer<MavenSession> runnable) {
    RepositorySystem repositorySystem = getComponent(RepositorySystem.class);
    DefaultMavenExecutionResult result = new DefaultMavenExecutionResult();
    myImporterSpy.setIndicator(indicator);

    SessionScope sessionScope = getComponent(SessionScope.class);
    sessionScope.enter();
    LegacySupport legacySupport = getComponent(LegacySupport.class);
    MavenSession oldSession = legacySupport.getSession();

    DefaultSessionFactory factory = getComponent(DefaultSessionFactory.class);

    IdeaMavenSessionBuilderSupplier sessionBuilderSupplier =
      new IdeaMavenSessionBuilderSupplier(repositorySystem, workspaceMap, indicator, request);
    try (RepositorySystemSession.CloseableSession repositorySystemSession = sessionBuilderSupplier.get().build()) {
      MavenSession mavenSession = new MavenSession(repositorySystemSession, request, result);
      InternalSession internalSession = factory.newSession(mavenSession);

      //noinspection SSBasedInspection
      internalSession.withRemoteRepositories(request.getRemoteRepositories().stream().map(
        r -> internalSession.getRemoteRepository(RepositoryUtils.toRepo(r))
      ).collect(Collectors.toList()));
      mavenSession.setSession(internalSession);
      sessionScope.seed(MavenSession.class, mavenSession);
      sessionScope.seed(Session.class, mavenSession.getSession());
      sessionScope.seed(InternalMavenSession.class, InternalMavenSession.from(mavenSession.getSession()));
      sessionScope.seed(InternalSession.class, internalSession);


      legacySupport.setSession(mavenSession);
      notifyAfterSessionStart(mavenSession);
      runnable.accept(mavenSession);
    }
    finally {
      legacySupport.setSession(oldSession);
      sessionScope.exit();
    }

    return result;
  }
public MavenExecutionResult executeWithMavenSession(@NotNull MavenExecutionRequest request,
                                                      @NotNull MavenWorkspaceMap workspaceMap,
                                                      @Nullable MavenServerConsoleIndicatorImpl indicator,
                                                      Consumer<MavenSession> runnable)