boolean (boolean before, CompileContext context) { List<MavenRunnerParameters> parametersList; synchronized (myStateLock) { var tasks = before ? myState.beforeCompileTasks : myState.afterCompileTasks; if (context.isRebuild()) { tasks = Sets.union(before ? myState.beforeRebuildTask : myState.afterRebuildTask, tasks); } var projectsManager = MavenProjectsManager.getInstance(myProject); var affectedModules = ReadAction.compute(() -> Set.of(context.getCompileScope().getAffectedModules())); var taskInfos = new ArrayList<MavenTaskInfo>(); for (var task : tasks) { var file = LocalFileSystem.getInstance().findFileByPath(task.getProjectPath()); if (file == null) continue; var mavenProject = projectsManager.findProject(file); if (null == mavenProject) continue; var module = ReadAction.compute(() -> projectsManager.findModule(mavenProject)); if (null == module) continue; if (!affectedModules.contains(module)) continue; var rootProject = projectsManager.findRootProject(mavenProject); if (null == rootProject) { rootProject = mavenProject; } taskInfos.add(new MavenTaskInfo(task.getGoal(), file, mavenProject, rootProject)); } var explicitProfiles = projectsManager.getExplicitProfiles(); parametersList = taskInfosToParametersList(taskInfos, explicitProfiles); } if (parametersList.isEmpty()) return true; return doRunTask(context, parametersList); }