Path (Class<?> klass) { final Path start = getSomeRoot(klass); Path home = start; while (home != null) { if (Files.exists(home.resolve(ULTIMATE_REPO_MARKER_FILE))) { return home; } // Handle Rider layout case if (Files.exists(home.resolve("ultimate").resolve(ULTIMATE_REPO_MARKER_FILE))) { return home.resolve("ultimate"); } home = home.getParent(); } throw new IllegalArgumentException("Cannot guess ultimate project home from root '" + start + "'" + ", marker file '" + ULTIMATE_REPO_MARKER_FILE + "'"); }