use of org.jetbrains.idea.maven.tasks.MavenBeforeRunTask in project azure-tools-for-java by Microsoft.
the class BeforeRunTaskUtils method createMavenPackageTask.
@NotNull
public static BeforeRunTask<?> createMavenPackageTask(@Nonnull MavenProject project, @NotNull RunConfiguration config) {
final String pomXmlPath = MavenUtils.getMavenModulePath(project);
final MavenBeforeRunTask task = new MavenBeforeRunTask();
task.setEnabled(true);
task.setProjectPath(pomXmlPath);
task.setGoal(MAVEN_TASK_PACKAGE);
return task;
}
use of org.jetbrains.idea.maven.tasks.MavenBeforeRunTask in project azure-tools-for-java by Microsoft.
the class MavenRunTaskUtil method shouldAddMavenPackageTask.
/**
* Legacy code, will be replaced by BeforeRunTaskUtils
* @deprecated
*/
@Deprecated
private static boolean shouldAddMavenPackageTask(List<BeforeRunTask> tasks, Project project) {
boolean shouldAdd = true;
for (BeforeRunTask task : tasks) {
if (task.getProviderId().equals(MavenBeforeRunTasksProvider.ID)) {
MavenBeforeRunTask mavenTask = (MavenBeforeRunTask) task;
if (mavenTask.getGoal().contains(MAVEN_TASK_PACKAGE) && Comparing.equal(mavenTask.getProjectPath(), project.getBasePath() + File.separator + MavenConstants.POM_XML)) {
mavenTask.setEnabled(true);
shouldAdd = false;
break;
}
}
}
return shouldAdd;
}
use of org.jetbrains.idea.maven.tasks.MavenBeforeRunTask in project intellij-community by JetBrains.
the class ToggleBeforeRunTaskAction method doIsSelected.
@Override
protected boolean doIsSelected(AnActionEvent e) {
final DataContext context = e.getDataContext();
final Pair<MavenProject, String> desc = getTaskDesc(context);
if (desc != null) {
final RunManagerEx runManager = getRunManager(context);
if (runManager == null)
return false;
for (MavenBeforeRunTask each : runManager.getBeforeRunTasks(MavenBeforeRunTasksProvider.ID)) {
if (each.isFor(desc.first, desc.second))
return true;
}
}
return false;
}
use of org.jetbrains.idea.maven.tasks.MavenBeforeRunTask in project google-cloud-intellij by GoogleCloudPlatform.
the class MavenBuildDeploymentSourceType method createBuildTask.
@Nullable
@Override
protected BeforeRunTask createBuildTask(@NotNull Module module) {
String mavenModulePath = getMavenModulePath(module);
if (mavenModulePath != null) {
MavenBeforeRunTask task = new MavenBeforeRunTask();
task.setProjectPath(mavenModulePath);
task.setGoal(MAVEN_TASK_PACKAGE);
task.setEnabled(true);
return task;
} else {
return null;
}
}
use of org.jetbrains.idea.maven.tasks.MavenBeforeRunTask in project azure-tools-for-java by Microsoft.
the class MavenRunTaskUtil method addMavenPackageBeforeRunTask.
/**
* Add Maven package goal into the run configuration's before run task.
*/
public static void addMavenPackageBeforeRunTask(RunConfiguration runConfiguration) {
final RunManagerEx manager = RunManagerEx.getInstanceEx(runConfiguration.getProject());
if (isMavenProject(runConfiguration.getProject())) {
List<BeforeRunTask> tasks = new ArrayList<>(manager.getBeforeRunTasks(runConfiguration));
if (MavenRunTaskUtil.shouldAddMavenPackageTask(tasks, runConfiguration.getProject())) {
MavenBeforeRunTask task = new MavenBeforeRunTask();
task.setEnabled(true);
task.setProjectPath(runConfiguration.getProject().getBasePath() + File.separator + MavenConstants.POM_XML);
task.setGoal(MAVEN_TASK_PACKAGE);
tasks.add(task);
manager.setBeforeRunTasks(runConfiguration, tasks);
}
}
}
Aggregations