@NotNull
  public static LocalMavenDistribution resolveEmbeddedMavenHome() {
    PluginDescriptor mavenPlugin = PluginManager.getPluginByClass(MavenDistributionsCache.class);

    if (PluginManagerCore.isRunningFromSources()) { // running from sources
      Path mavenPath = mySourcePath.getValue();
      return new LocalMavenDistribution(mavenPath, BundledMaven3.INSTANCE.getTitle());
    } else if (mavenPlugin != null) { // running with production classloading. Use maven3 folder inside maven plugin layout
      Path pathToBundledMaven = mavenPlugin.getPluginPath().resolve("lib").resolve("maven3");
      return new LocalMavenDistribution(pathToBundledMaven, BundledMaven3.INSTANCE.getTitle());
    }
    else { // running with non-production class loader, e.g. integration tests
      final Path pluginFileOrDir = Path.of(PathUtil.getJarPathForClass(MavenServerManager.class));
      Path pathToBundledMaven = pluginFileOrDir.getParent().resolve("maven3");
      return new LocalMavenDistribution(pathToBundledMaven, BundledMaven3.INSTANCE.getTitle());
    }
  }
@NotNull
  public static LocalMavenDistribution resolveEmbeddedMavenHome()