boolean (@NotNull Project project, @NotNull ProjectTask projectTask) { if (!MavenRunner.getInstance(project).getSettings().isDelegateBuildToMaven()) { return false; } if (projectTask instanceof ModuleBuildTask) { Module module = ((ModuleBuildTask)projectTask).getModule(); return isMavenModule(module); } if (projectTask instanceof ProjectModelBuildTask buildTask) { if (buildTask.getBuildableElement() instanceof Artifact artifact) { MavenArtifactProperties properties = null; for (ArtifactPropertiesProvider provider : artifact.getPropertiesProviders()) { if (provider instanceof MavenArtifactPropertiesProvider) { ArtifactProperties<?> artifactProperties = artifact.getProperties(provider); if (artifactProperties instanceof MavenArtifactProperties) { properties = (MavenArtifactProperties)artifactProperties; break; } } } if (properties == null || properties.getModuleName() == null) { return false; } Module module = ModuleManager.getInstance(project).findModuleByName(properties.getModuleName()); if (!isMavenModule(module)) { return false; } for (MavenArtifactBuilder artifactBuilder : MavenArtifactBuilder.EP_NAME.getExtensions()) { if (artifactBuilder.isApplicable(buildTask)) { return true; } } } } if (projectTask instanceof ExecuteRunConfigurationTask task) { RunProfile runProfile = task.getRunProfile(); if (runProfile instanceof JavaScratchConfiguration) { return false; } if (runProfile instanceof ModuleBasedConfiguration) { RunConfigurationModule module = ((ModuleBasedConfiguration<?, ?>)runProfile).getConfigurationModule(); if (!isMavenModule(module.getModule())) { return false; } for (MavenExecutionEnvironmentProvider environmentProvider : MavenExecutionEnvironmentProvider.EP_NAME.getExtensions()) { if (environmentProvider.isApplicable(task)) { return true; } } } } return false; }