String (@NotNull String subProjectPath) { final Path subProject = Paths.get(subProjectPath); Path candidate = subProject; try { while (candidate != null && candidate != candidate.getParent()) { if (containsGradleSettingsFile(candidate)) { return candidate.toString(); } candidate = candidate.getParent(); } } catch (IOException e) { GradleLog.LOG.warn("Failed to determine root Gradle project directory for [" + subProjectPath + "]", e); } return Files.isDirectory(subProject) ? subProjectPath : subProject.getParent().toString(); }