public static void addVMParameters( ParametersList parametersList, String mavenHome, MavenRunnerSettings runnerSettings) { parametersList.addParametersString(System.getenv(MAVEN_OPTS)); parametersList.addParametersString(runnerSettings.getVmOptions()); parametersList.addProperty("maven.home", mavenHome); }
@NotNull private static Sdk getJdk( @Nullable Project project, MavenRunnerSettings runnerSettings, boolean isGlobalRunnerSettings) throws ExecutionException { String name = runnerSettings.getJreName(); if (name.equals(MavenRunnerSettings.USE_INTERNAL_JAVA)) { return JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk(); } if (name.equals(MavenRunnerSettings.USE_PROJECT_JDK)) { if (project != null) { Sdk res = ProjectRootManager.getInstance(project).getProjectSdk(); if (res != null) { return res; } } if (project == null) { Sdk recent = ProjectJdkTable.getInstance().findMostRecentSdkOfType(JavaSdk.getInstance()); if (recent != null) return recent; return JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk(); } throw new ProjectJdkSettingsOpenerExecutionException( "Project JDK is not specified. <a href='#'>Configure</a>", project); } if (name.equals(MavenRunnerSettings.USE_JAVA_HOME)) { final String javaHome = System.getenv(JAVA_HOME); if (StringUtil.isEmptyOrSpaces(javaHome)) { throw new ExecutionException(RunnerBundle.message("maven.java.home.undefined")); } final Sdk jdk = JavaSdk.getInstance().createJdk("", javaHome); if (jdk == null) { throw new ExecutionException(RunnerBundle.message("maven.java.home.invalid", javaHome)); } return jdk; } for (Sdk projectJdk : ProjectJdkTable.getInstance().getAllJdks()) { if (projectJdk.getName().equals(name)) { return projectJdk; } } if (isGlobalRunnerSettings) { throw new ExecutionException( RunnerBundle.message("maven.java.not.found.default.config", name)); } else { throw new ExecutionException(RunnerBundle.message("maven.java.not.found", name)); } }
private static void addMavenParameters( ParametersList parametersList, String mavenHome, MavenGeneralSettings coreSettings, MavenRunnerSettings runnerSettings, MavenRunnerParameters parameters) { encodeCoreAndRunnerSettings(coreSettings, mavenHome, parametersList); if (runnerSettings.isSkipTests()) { parametersList.addProperty("skipTests", "true"); } for (Map.Entry<String, String> entry : runnerSettings.getMavenProperties().entrySet()) { if (entry.getKey().length() > 0) { parametersList.addProperty(entry.getKey(), entry.getValue()); } } for (String goal : parameters.getGoals()) { parametersList.add(goal); } addOption(parametersList, "P", encodeProfiles(parameters.getProfilesMap())); }