private static boolean containsGradleSettingsFile(Path directory) throws IOException {
    if (!Files.isDirectory(directory)) {
      return false;
    }
    try (Stream<Path> stream = Files.walk(directory, 1)) {
      return stream
        .map(Path::getFileName)
        .filter(Objects::nonNull)
        .map(Path::toString)
        .anyMatch(name -> name.startsWith("settings.gradle"));
    }
  }
private static boolean containsGradleSettingsFile(Path directory)