void performTask() {
    final LocalFileSystem localFileSystem = LocalFileSystem.getInstance();
    final List<PsiFile> psiFileList = new ArrayList<>();

    final ModuleManager moduleManager = ModuleManager.getInstance(myProject);
    for (Module module : moduleManager.getModules()) {
      if (!ExternalSystemApiUtil.isExternalSystemAwareModule(GradleConstants.SYSTEM_ID, module)) continue;

      final String modulePath = ExternalSystemApiUtil.getExternalProjectPath(module);
      if (modulePath == null) continue;

      String buildScript = FileUtil.findFileInProvidedPath(modulePath, GradleConstants.DEFAULT_SCRIPT_NAME);
      if (StringUtil.isEmpty(buildScript)) continue;

      VirtualFile virtualFile =
        localFileSystem.refreshAndFindFileByPath(buildScript);
      if (virtualFile == null) continue;

      final PsiFile psiFile = PsiManager.getInstance(myProject).findFile(virtualFile);
      if (psiFile == null) continue;
      psiFileList.add(psiFile);
    }

    final PsiFile[] psiFiles = psiFileList.toArray(PsiFile.EMPTY_ARRAY);

    final Set<MavenRemoteRepository> mavenRemoteRepositories = ReadAction.compute(() -> {
      Set<MavenRemoteRepository> myRemoteRepositories = new HashSet<>();
      for (PsiFile psiFile : psiFiles) {
        List<GrClosableBlock> repositoriesBlocks = new ArrayList<>(findClosableBlocks(psiFile, "repositories"));

        for (GrClosableBlock closableBlock : findClosableBlocks(psiFile, "buildscript", "subprojects", "allprojects", "project",
                                                                "configure")) {
          repositoriesBlocks.addAll(findClosableBlocks(closableBlock, "repositories"));
        }

        for (GrClosableBlock repositoriesBlock : repositoriesBlocks) {
          myRemoteRepositories.addAll(findMavenRemoteRepositories(repositoriesBlock));
        }
      }
      return myRemoteRepositories;
    });

    if (mavenRemoteRepositories == null || mavenRemoteRepositories.isEmpty()) return;

    // register imported maven repository URLs but do not force to download the index
    // the index can be downloaded and/or updated later using Maven Configuration UI (Settings -> Build, Execution, Deployment -> Build tools -> Maven -> Repositories)
    MavenRepositoriesHolder.getInstance(myProject).update(mavenRemoteRepositories);
    MavenIndicesManager.getInstance(myProject).scheduleUpdateIndicesList();
  }
void performTask()