• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MavenRunnerParameters类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jetbrains.idea.maven.execution.MavenRunnerParameters的典型用法代码示例。如果您正苦于以下问题:Java MavenRunnerParameters类的具体用法?Java MavenRunnerParameters怎么用?Java MavenRunnerParameters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MavenRunnerParameters类属于org.jetbrains.idea.maven.execution包,在下文中一共展示了MavenRunnerParameters类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: checkOrPerform

import org.jetbrains.idea.maven.execution.MavenRunnerParameters; //导入依赖的package包/类
private static boolean checkOrPerform(DataContext context, boolean perform) {
  final List<String> goals = MavenDataKeys.MAVEN_GOALS.getData(context);
  if (goals == null || goals.isEmpty()) return false;

  final Project project = MavenActionUtil.getProject(context);
  if(project == null) return false;
  final MavenProject mavenProject = MavenActionUtil.getMavenProject(context);
  if (mavenProject == null) return false;

  if (!perform) return true;

  final MavenProjectsManager projectsManager = MavenActionUtil.getProjectsManager(context);
  if(projectsManager == null) return false;
  MavenExplicitProfiles explicitProfiles = projectsManager.getExplicitProfiles();
  final MavenRunnerParameters params = new MavenRunnerParameters(true,
                                                                 mavenProject.getDirectory(),
                                                                 goals,
                                                                 explicitProfiles.getEnabledProfiles(),
                                                                 explicitProfiles.getDisabledProfiles());
  MavenRunConfigurationType.runConfiguration(project, params, null);

  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:RunBuildAction.java


示例2: doExecute

import org.jetbrains.idea.maven.execution.MavenRunnerParameters; //导入依赖的package包/类
private boolean doExecute(boolean before, CompileContext context) {
  List<MavenRunnerParameters> parametersList;
  synchronized (this) {
    parametersList = new ArrayList<MavenRunnerParameters>();
    Set<MavenCompilerTask> tasks = before ? myState.beforeCompileTasks : myState.afterCompileTasks;

    if (context.isRebuild()) {
      tasks = Sets.union(before ? myState.beforeRebuildTask : myState.afterRebuildTask, tasks);
    }

    for (MavenCompilerTask each : tasks) {
      VirtualFile file = LocalFileSystem.getInstance().findFileByPath(each.getProjectPath());
      if (file == null) continue;
      MavenExplicitProfiles explicitProfiles = myProjectsManager.getExplicitProfiles();
      parametersList.add(new MavenRunnerParameters(true,
                                                   file.getParent().getPath(),
                                                   Arrays.asList(each.getGoal()),
                                                   explicitProfiles.getEnabledProfiles(),
                                                   explicitProfiles.getDisabledProfiles()));
    }
  }
  return myRunner.runBatch(parametersList, null, null, TasksBundle.message("maven.tasks.executing"), context.getProgressIndicator());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:MavenTasksManager.java


示例3: runConfiguration

import org.jetbrains.idea.maven.execution.MavenRunnerParameters; //导入依赖的package包/类
public static void runConfiguration(Project project,
                                    @NotNull MavenRunnerParameters params,
                                    @Nullable MavenGeneralSettings settings,
                                    @Nullable MavenRunnerSettings runnerSettings,
                                    @Nullable ProgramRunner.Callback callback) {
    RunnerAndConfigurationSettings configSettings = createRunnerAndConfigurationSettings(settings,
            runnerSettings,
            params,
            project);

    ProgramRunner runner = DefaultJavaProgramRunner.getInstance();
    Executor executor = DefaultRunExecutor.getRunExecutorInstance();
    ExecutionEnvironment env = new ExecutionEnvironment(executor, runner, configSettings, project);

    try {
       runner.execute(env, callback);
    }
    catch (ExecutionException e) {
        MavenUtil.showError(project, "Failed to execute Maven goal", e);
    }
}
 
开发者ID:shlxue,项目名称:MvnRunner,代码行数:22,代码来源:MvnRunConfigurationType.java


示例4: generateName

import org.jetbrains.idea.maven.execution.MavenRunnerParameters; //导入依赖的package包/类
private static String generateName(Project project, MavenRunnerParameters runnerParameters) {
    String name = "";
    for (MavenProject mavenProject : MavenProjectsManager.getInstance(project).getProjects()) {
        if (runnerParameters.getWorkingDirPath().equals(mavenProject.getDirectory())) {
            name = mavenProject.getMavenId().getArtifactId();
            break;
        }
    }
    StringBuilder param = new StringBuilder();
    for (String s : runnerParameters.getGoals()) {
        param.append(s).append(",");
    }
    if (param.length() > 40) param.setLength(37);
    if (param.charAt(param.length() - 1) == ',') param.setLength(param.length() - 1);
    return MvnBundle.message("mvn.build.name", name, param);
}
 
开发者ID:shlxue,项目名称:MvnRunner,代码行数:17,代码来源:MvnRunConfigurationType.java


示例5: checkOrPerform

import org.jetbrains.idea.maven.execution.MavenRunnerParameters; //导入依赖的package包/类
private static boolean checkOrPerform(DataContext context, boolean perform) {
  final List<String> goals = MavenDataKeys.MAVEN_GOALS.getData(context);
  if (goals == null || goals.isEmpty()) return false;

  final MavenProject project = MavenActionUtil.getMavenProject(context);
  if (project == null) return false;

  if (!perform) return true;

  final MavenRunnerParameters params = new MavenRunnerParameters(true,
                                                                 project.getDirectory(),
                                                                 goals,
                                                                 MavenActionUtil.getProjectsManager(context).getExplicitProfiles());
  MavenRunConfigurationType.runConfiguration(MavenActionUtil.getProject(context), params, null);

  return true;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:RunBuildAction.java


示例6: doExecute

import org.jetbrains.idea.maven.execution.MavenRunnerParameters; //导入依赖的package包/类
private boolean doExecute(boolean before, CompileContext context) {
  List<MavenRunnerParameters> parametersList;
  synchronized (this) {
    parametersList = new ArrayList<MavenRunnerParameters>();
    Set<MavenCompilerTask> tasks = before ? myState.beforeCompileTasks : myState.afterCompileTasks;
    for (MavenCompilerTask each : tasks) {
      VirtualFile file = LocalFileSystem.getInstance().findFileByPath(each.getProjectPath());
      if (file == null) continue;
      parametersList.add(new MavenRunnerParameters(true,
                                                   file.getParent().getPath(),
                                                   Arrays.asList(each.getGoal()),
                                                   myProjectsManager.getExplicitProfiles()));
    }
  }
  return myRunner.runBatch(parametersList, null, null, TasksBundle.message("maven.tasks.executing"), context.getProgressIndicator());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:MavenTasksManager.java


示例7: actionPerformed

import org.jetbrains.idea.maven.execution.MavenRunnerParameters; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
	MavenProject mavenProject = MavenActionUtil.getMavenProject(e.getDataContext());
	if (mavenProject != null) {

		PsiFile psiFile = LangDataKeys.PSI_FILE.getData(e.getDataContext());
		if (psiFile instanceof PsiJavaFile) {
			List<String> goals = getGoals(e, (PsiJavaFile) psiFile,
					MavenActionUtil.getMavenProject(e.getDataContext()));

			final DataContext context = e.getDataContext();
			MavenRunnerParameters params = new MavenRunnerParameters(true, mavenProject.getDirectory(), goals,
					MavenActionUtil.getProjectsManager(context).getExplicitProfiles());
			run(context, params);
		} else {
			Messages.showWarningDialog(e.getProject(), "Cannot run for current file", "Maven Test File");
		}
	}
}
 
开发者ID:krasa,项目名称:MavenHelper,代码行数:19,代码来源:RunTestFileAction.java


示例8: actionPerformed

import org.jetbrains.idea.maven.execution.MavenRunnerParameters; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
	ApplicationComponent instance = ApplicationComponent.getInstance();
	ApplicationSettings state = instance.getState();

	String pomDir = null;
	if (state.isUseIgnoredPoms()) {
		VirtualFile data = CommonDataKeys.VIRTUAL_FILE.getData(e.getDataContext());
		if (data != null) {
			File focusedFile = new File(data.getPath());
			pomDir = getNearbyPOMDir(focusedFile);
		}       	
	} else {
		MavenProject mavenProject = MavenActionUtil.getMavenProject(e.getDataContext());
		if (mavenProject != null) {
			pomDir = mavenProject.getDirectory();
		}
	}
	if (pomDir != null) {
		final DataContext context = e.getDataContext();
		MavenProjectsManager projectsManager = MavenActionUtil.getProjectsManager(context);
		MavenRunnerParameters params = new MavenRunnerParameters(true, pomDir, goalsToRun,
				projectsManager.getExplicitProfiles());
		run(context, params);
	}
}
 
开发者ID:krasa,项目名称:MavenHelper,代码行数:26,代码来源:RunGoalAction.java


示例9: MavenConsoleImpl

import org.jetbrains.idea.maven.execution.MavenRunnerParameters; //导入依赖的package包/类
public MavenConsoleImpl(String title,
                        Project project,
                        Pair<MavenRunnerParameters, MavenRunnerSettings> parametersAndSettings) {
  super(getGeneralSettings(project).getLoggingLevel(), getGeneralSettings(project).isPrintErrorStackTraces());
  myTitle = title;
  myProject = project;
  myConsoleView = createConsoleView();
  myParametersAndSettings = parametersAndSettings;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:MavenConsoleImpl.java


示例10: actionPerformed

import org.jetbrains.idea.maven.execution.MavenRunnerParameters; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
  final DataContext context = e.getDataContext();
  final Project project = MavenActionUtil.getProject(context);
  if (project == null) return;

  final MavenProjectsManager projectsManager = MavenActionUtil.getProjectsManager(context);
  if(projectsManager == null) return;
  MavenExplicitProfiles explicitProfiles = projectsManager.getExplicitProfiles();
  MavenRunnerParameters params = new MavenRunnerParameters(true,
                                                           myMavenProject.getDirectory(),
                                                           Collections.singletonList(myGoal),
                                                           explicitProfiles.getEnabledProfiles(),
                                                           explicitProfiles.getDisabledProfiles());
  MavenRunConfigurationType.runConfiguration(project, params, null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:MavenKeymapExtension.java


示例11: generateFromArchetype

import org.jetbrains.idea.maven.execution.MavenRunnerParameters; //导入依赖的package包/类
private void generateFromArchetype(final Project project, final VirtualFile pom) {
  final File workingDir;
  try {
    workingDir = FileUtil.createTempDirectory("archetype", "tmp");
    workingDir.deleteOnExit();
  }
  catch (IOException e) {
    showError(project, e);
    return;
  }

  MavenRunnerParameters params = new MavenRunnerParameters(
    false, workingDir.getPath(),
    Collections.singletonList("org.apache.maven.plugins:maven-archetype-plugin:RELEASE:generate"),
    Collections.<String>emptyList());

  MavenRunner runner = MavenRunner.getInstance(project);
  MavenRunnerSettings settings = runner.getState().clone();
  Map<String, String> props = settings.getMavenProperties();

  props.put("interactiveMode", "false");
  //props.put("archetypeGroupId", myArchetype.groupId);
  //props.put("archetypeArtifactId", myArchetype.artifactId);
  //props.put("archetypeVersion", myArchetype.version);
  //if (myArchetype.repository != null) props.put("archetypeRepository", myArchetype.repository);

  //props.put("groupId", myProjectId.getGroupId());
  //props.put("artifactId", myProjectId.getArtifactId());
  //props.put("version", myProjectId.getVersion());

  props.putAll(myPropertiesToCreateByArtifact);

  runner.run(params, settings, new Runnable() {
    public void run() {
      copyGeneratedFiles(workingDir, pom, project);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:MavenModuleBuilderHelper.java


示例12: actionPerformed

import org.jetbrains.idea.maven.execution.MavenRunnerParameters; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
    Project project =  e.getRequiredData(CommonDataKeys.PROJECT);
    final MavenProject mavenProject = getProject(e.getDataContext());

    MavenRunnerParameters parameters = createParameters(mavenProject);
    MavenGeneralSettings settings = getGeneralSettings(e.getProject());
    MavenRunnerSettings runnerSettings = createRunnerSettings(e.getProject());
    MvnRunConfigurationType.runConfiguration(project, parameters, settings, runnerSettings);
}
 
开发者ID:shlxue,项目名称:MvnRunner,代码行数:11,代码来源:MvnPhaseGoalAction.java


示例13: isConfigurationFromContext

import org.jetbrains.idea.maven.execution.MavenRunnerParameters; //导入依赖的package包/类
@Override
public boolean isConfigurationFromContext(MvnRunConfiguration config, ConfigurationContext context) {
    if (isContext(context)) {
        MavenRunnerParameters parameters = config.getRunnerParameters();
        if (Comparing.strEqual(mavenProject.getDirectory(), parameters.getWorkingDirPath())) {
            List<String> testParameters = generateMvnParameters();
            return isSameParameters(testParameters, parameters.getGoals());
        }
    }
    return false;
}
 
开发者ID:shlxue,项目名称:MvnRunner,代码行数:12,代码来源:MavenModuleConfigurationProducer.java


示例14: setupConfigurationFromContext

import org.jetbrains.idea.maven.execution.MavenRunnerParameters; //导入依赖的package包/类
@Override
protected boolean setupConfigurationFromContext(MvnRunConfiguration config, ConfigurationContext context, Ref<PsiElement> ref) {
    if (context == null) return false;
    if (!initContext(context) || !isContext(context)) return false;

    final MavenRunnerParameters params = createMavenParameters(context.getLocation(), context.getDataContext());
    if (params != null) {
        config.setRunnerParameters(params);
        return setupMavenContext(config, config.getRunnerParameters().getGoals());
    }
    return false;
}
 
开发者ID:shlxue,项目名称:MvnRunner,代码行数:13,代码来源:MavenModuleConfigurationProducer.java


示例15: createMavenParameters

import org.jetbrains.idea.maven.execution.MavenRunnerParameters; //导入依赖的package包/类
protected MavenRunnerParameters createMavenParameters(Location l, DataContext dataContext) {
    if (l instanceof PsiLocation) {
        MavenExplicitProfiles profiles = MavenActionUtil.getProjectsManager(dataContext).getExplicitProfiles();
        return new MavenRunnerParameters(true, mavenProject.getDirectory(), null, profiles);
    }
    return null;
}
 
开发者ID:shlxue,项目名称:MvnRunner,代码行数:8,代码来源:MavenModuleConfigurationProducer.java


示例16: createRunnerAndConfigurationSettings

import org.jetbrains.idea.maven.execution.MavenRunnerParameters; //导入依赖的package包/类
private static RunnerAndConfigurationSettings createRunnerAndConfigurationSettings(@Nullable MavenGeneralSettings generalSettings,
                                                                                  @Nullable MavenRunnerSettings runnerSettings,
                                                                                  MavenRunnerParameters params,
                                                                                  Project project) {
    MvnRunConfigurationType type = ConfigurationTypeUtil.findConfigurationType(MvnRunConfigurationType.class);
    final RunnerAndConfigurationSettings settings = RunManagerEx.getInstanceEx(project).createRunConfiguration(generateName(project, params), type.myFactory);
    MvnRunConfiguration runConfiguration = (MvnRunConfiguration)settings.getConfiguration();
    runConfiguration.setRunType(getPhaseRunType(params.getGoals()));
    runConfiguration.setRunnerParameters(params);
    runConfiguration.setGeneralSettings(generalSettings);
    runConfiguration.setRunnerSettings(runnerSettings);
    return settings;
}
 
开发者ID:shlxue,项目名称:MvnRunner,代码行数:14,代码来源:MvnRunConfigurationType.java


示例17: actionPerformed

import org.jetbrains.idea.maven.execution.MavenRunnerParameters; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
  final DataContext context = e.getDataContext();
  MavenRunnerParameters params = new MavenRunnerParameters(true,
                                                           myMavenProject.getDirectory(),
                                                           Arrays.asList(myGoal),
                                                           MavenActionUtil.getProjectsManager(context).getExplicitProfiles());
  MavenRunConfigurationType.runConfiguration(MavenActionUtil.getProject(context), params, null);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:9,代码来源:MavenKeymapExtension.java


示例18: generateFromArchetype

import org.jetbrains.idea.maven.execution.MavenRunnerParameters; //导入依赖的package包/类
private void generateFromArchetype(final Project project, final VirtualFile pom) {
  final File workingDir;
  try {
    workingDir = FileUtil.createTempDirectory("archetype", "tmp");
    workingDir.deleteOnExit();
  }
  catch (IOException e) {
    showError(project, e);
    return;
  }

  MavenRunnerParameters params = new MavenRunnerParameters(
    false, workingDir.getPath(), Collections.singletonList("org.apache.maven.plugins:maven-archetype-plugin:RELEASE:generate"), null);

  MavenRunner runner = MavenRunner.getInstance(project);
  MavenRunnerSettings settings = runner.getState().clone();
  Map<String, String> props = settings.getMavenProperties();

  props.put("interactiveMode", "false");
  //props.put("archetypeGroupId", myArchetype.groupId);
  //props.put("archetypeArtifactId", myArchetype.artifactId);
  //props.put("archetypeVersion", myArchetype.version);
  //if (myArchetype.repository != null) props.put("archetypeRepository", myArchetype.repository);

  //props.put("groupId", myProjectId.getGroupId());
  //props.put("artifactId", myProjectId.getArtifactId());
  //props.put("version", myProjectId.getVersion());

  props.putAll(myPropertiesToCreateByArtifact);

  runner.run(params, settings, new Runnable() {
    public void run() {
      copyGeneratedFiles(workingDir, pom, project);
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:37,代码来源:MavenModuleBuilderHelper.java


示例19: debugConfiguration

import org.jetbrains.idea.maven.execution.MavenRunnerParameters; //导入依赖的package包/类
public static void debugConfiguration(Project project, @NotNull MavenRunnerParameters params,
		@Nullable MavenGeneralSettings settings, @Nullable MavenRunnerSettings runnerSettings,
		@Nullable ProgramRunner.Callback callback) {

	RunnerAndConfigurationSettings configSettings = MavenRunConfigurationType.createRunnerAndConfigurationSettings(
			settings, runnerSettings, params, project);
	final Executor executor = DefaultDebugExecutor.getDebugExecutorInstance();

	debugConfiguration(project, callback, configSettings, executor);
}
 
开发者ID:krasa,项目名称:MavenHelper,代码行数:11,代码来源:MavenDebugConfigurationType.java


示例20: executeTask

import org.jetbrains.idea.maven.execution.MavenRunnerParameters; //导入依赖的package包/类
@Override
public boolean executeTask(DataContext dataContext, RunConfiguration runConfiguration, ExecutionEnvironment executionEnvironment, MuleBeforeRunTask muleBeforeRunTask)
{
    final Semaphore targetDone = new Semaphore();
    final List<Boolean> results = new ArrayList<>();

    final Project project = executionEnvironment.getProject();

    MuleConfiguration muleConfiguration = (MuleConfiguration) runConfiguration;

    Module[] modules = muleConfiguration.getModules();

    for (Module nextModule : modules) {
        //final MavenProject mavenProject = getMavenProject(runConfiguration, project);
        final MavenProject mavenProject = getMavenProject(nextModule);
        try {
            ApplicationManager.getApplication().invokeAndWait(new Runnable() {
                public void run() {
                    if (!project.isDisposed() && mavenProject != null) {
                        FileDocumentManager.getInstance().saveAllDocuments();
                        final MavenExplicitProfiles explicitProfiles = MavenProjectsManager.getInstance(project).getExplicitProfiles();
                        final MavenRunner mavenRunner = MavenRunner.getInstance(project);
                        targetDone.down();
                        (new Task.Backgroundable(project, TasksBundle.message("maven.tasks.executing"), true) {
                            public void run(@NotNull ProgressIndicator indicator) {
                                try {
                                    MavenRunnerParameters params =
                                            new MavenRunnerParameters(true, mavenProject.getDirectory(), ParametersListUtil.parse("package"), explicitProfiles.getEnabledProfiles(),
                                                    explicitProfiles.getDisabledProfiles());
                                    boolean result = mavenRunner.runBatch(Collections.singletonList(params), null, null, TasksBundle.message("maven.tasks.executing"), indicator);
                                    results.add(result);
                                } finally {
                                    targetDone.up();
                                }
                            }

                            public boolean shouldStartInBackground() {
                                return MavenRunner.getInstance(project).getSettings().isRunMavenInBackground();
                            }

                            public void processSentToBackground() {
                                MavenRunner.getInstance(project).getSettings().setRunMavenInBackground(true);
                            }
                        }).queue();
                    }
                }
            }, ModalityState.NON_MODAL);
        } catch (Exception exeception) {
            return false;
        }
        targetDone.waitFor();
    }

    boolean endResult = true;

    for (Boolean nextResult : results) {
        endResult = endResult && nextResult;
    }

    return endResult;
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:62,代码来源:MuleBeforeRunTasksProvider.java



注:本文中的org.jetbrains.idea.maven.execution.MavenRunnerParameters类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HadoopPolicyProvider类代码示例发布时间:2022-05-22
下一篇:
Java Jvm类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap