本文整理汇总了Java中org.jetbrains.idea.maven.execution.MavenRunnerParameters类的典型用法代码示例。如果您正苦于以下问题:Java MavenRunnerParameters类的具体用法?Java MavenRunnerParameters怎么用?Java MavenRunnerParameters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MavenRunnerParameters类属于org.jetbrains.idea.maven.execution包,在下文中一共展示了MavenRunnerParameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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());
}
示例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);
}
}
示例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);
}
示例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;
}
示例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());
}
示例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");
}
}
}
示例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);
}
}
示例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;
}
示例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);
}
示例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);
}
});
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}