@Override
  public void deploy(final @NotNull DeploymentTask<D> task,
                     final java.util.function.@NotNull Consumer<? super String> onDeploymentStarted) {
    connectIfNeeded(new ConnectionCallbackBase<>() {
      @Override
      public void connected(@NotNull ServerRuntimeInstance<D> instance) {
        LocalDeploymentImpl<?> deployment = new LocalDeploymentImpl<>(instance,
                                                                      ServerConnectionImpl.this,
                                                                      DeploymentStatus.DEPLOYING,
                                                                      null,
                                                                      null,
                                                                      task);
        String deploymentName = deployment.getName();
        myAllDeployments.addLocal(deployment);

        DeploymentLogManagerImpl logManager = myPerProjectLogManagers.computeIfAbsent(task.getProject(), LogManagersForProject::new)
          .findOrCreateManager(deployment)
          .withMainHandlerVisible(true);

        LoggingHandlerImpl handler = logManager.getMainLoggingHandler();
        handler.printlnSystemMessage("Deploying '" + deploymentName + "'...");
        onDeploymentStarted.accept(deploymentName);
        instance
          .deploy(task, logManager, new DeploymentOperationCallbackImpl(deploymentName, (DeploymentTaskImpl<D>)task, handler, deployment));
      }
    });
  }
@Override
  public void deploy(final @NotNull DeploymentTask<D> task,
                     final java.util.function.@NotNull Consumer<? super String> onDeploymentStarted)