@NotNull
  @Override
  public Collection<TaskData> populateModuleTasks(@NotNull IdeaModule gradleModule,
                                                  @NotNull DataNode<ModuleData> ideModule,
                                                  @NotNull DataNode<ProjectData> ideProject)
    throws IllegalArgumentException, IllegalStateException {

    final Collection<TaskData> tasks = new ArrayList<>();
    GradleModuleData gradleModuleData = new GradleModuleData(ideModule);
    final String moduleConfigPath = gradleModuleData.getGradleProjectDir();

    ExternalProject externalProject = getExternalProject(gradleModule, resolverCtx);
    if (externalProject != null) {
      String directoryToRunTask = gradleModuleData.getDirectoryToRunTask();
      boolean isSimpleTaskNameAllowed = directoryToRunTask.equals(moduleConfigPath);

      for (ExternalTask task : externalProject.getTasks().values()) {
        String taskGroup = task.getGroup();
        if (task.getName().trim().isEmpty() || isIdeaTask(task.getName(), taskGroup)) {
          continue;
        }
        boolean inherited = StringUtil.equals(task.getName(), task.getQName());
        String taskFullName;
        if (gradleModuleData.isIncludedBuild()) {
          if (inherited) {
            // running a task for all subprojects using the qualified task name is not supported for included builds
            continue;
          }
          taskFullName = gradleModuleData.getTaskPathOfSimpleTaskName(task.getName());
        }
        else {
          taskFullName = isSimpleTaskNameAllowed ? task.getName() : task.getQName();
        }

        String escapedTaskName = ParametersListUtil.escape(taskFullName);
        TaskData taskData = new TaskData(GradleConstants.SYSTEM_ID, escapedTaskName, directoryToRunTask, task.getDescription());
        taskData.setGroup(taskGroup);
        taskData.setType(task.getType());
        taskData.setTest(task.isTest());
        taskData.setJvmTest(task.isJvmTest());
        ideModule.createChild(ProjectKeys.TASK, taskData);
        taskData.setInherited(inherited);
        tasks.add(taskData);
      }
      return tasks;
    }

    for (GradleTask task : gradleModule.getGradleProject().getTasks()) {
      String taskName = task.getName();
      String taskGroup = getTaskGroup(task);
      if (taskName == null || taskName.trim().isEmpty() || isIdeaTask(taskName, taskGroup)) {
        continue;
      }
      TaskData taskData = new TaskData(GradleConstants.SYSTEM_ID, taskName, moduleConfigPath, task.getDescription());
      taskData.setGroup(taskGroup);
      ideModule.createChild(ProjectKeys.TASK, taskData);
      tasks.add(taskData);
    }

    return tasks;
  }
@NotNull
  @Override
  public Collection<TaskData> populateModuleTasks(@NotNull IdeaModule gradleModule,
                                                  @NotNull DataNode<ModuleData> ideModule,
                                                  @NotNull DataNode<ProjectData> ideProject)