use of org.eclipse.che.plugin.maven.server.execution.JavaParameters in project che by eclipse.
the class MavenServerManagerTest method testBuildMavenServerParametersMainWorkDirExec.
@Test
public void testBuildMavenServerParametersMainWorkDirExec() throws Exception {
MavenServerManager test = new MavenServerManager("test");
try {
JavaParameters parameters = test.buildMavenServerParameters();
assertThat(parameters.getMainClassName()).isEqualTo("org.eclipse.che.maven.server.MavenServerMain");
assertThat(parameters.getWorkingDirectory()).isEqualTo(System.getProperty("java.io.tmpdir"));
assertThat(parameters.getJavaExecutable()).isEqualTo("java");
} finally {
test.shutdown();
}
}
use of org.eclipse.che.plugin.maven.server.execution.JavaParameters in project che by eclipse.
the class MavenServerManagerTest method testBuildMavenServerParametersClassPathMain.
@Test
public void testBuildMavenServerParametersClassPathMain() throws Exception {
JavaParameters parameters = manager.buildMavenServerParameters();
List<String> classPath = parameters.getClassPath();
assertThat(classPath).contains(mavenServerPath + "/maven-server-impl.jar").contains(mavenServerPath + "/maven-server-api.jar");
}
use of org.eclipse.che.plugin.maven.server.execution.JavaParameters in project che by eclipse.
the class MavenServerManagerTest method testBuildMavenServerParametersClassPathMavenLib.
@Test
public void testBuildMavenServerParametersClassPathMavenLib() throws Exception {
JavaParameters parameters = manager.buildMavenServerParameters();
List<String> classPath = parameters.getClassPath();
String mavenHome = System.getenv("M2_HOME");
File libs = new File(mavenHome, "lib");
File[] listFiles = libs.listFiles((dir, name) -> name.endsWith(".jar"));
List<String> libPaths = Arrays.stream(listFiles).map(File::getAbsolutePath).collect(Collectors.toList());
assertThat(classPath).contains(libPaths.toArray());
}
use of org.eclipse.che.plugin.maven.server.execution.JavaParameters in project che by eclipse.
the class MavenServerManager method buildMavenServerParameters.
public JavaParameters buildMavenServerParameters() {
JavaParameters parameters = new JavaParameters();
parameters.setJavaExecutable("java");
parameters.setWorkingDirectory(System.getProperty("java.io.tmpdir"));
parameters.setMainClassName(MAVEN_SERVER_MAIN);
//TODO read and set MAVEN_OPTS system properties
List<String> classPath = new ArrayList<>();
addDirToClasspath(classPath, new File(mavenServerPath));
String mavenHome = System.getenv("M2_HOME");
addDirToClasspath(classPath, new File(mavenHome, "lib"));
File bootDir = new File(mavenHome, "boot");
File[] classworlds = bootDir.listFiles((dir, name) -> {
return name.contains("classworlds");
});
if (classworlds != null) {
for (File file : classworlds) {
classPath.add(file.getAbsolutePath());
}
}
parameters.getClassPath().addAll(classPath);
parameters.getVmParameters().add("-Xmx512m");
return parameters;
}
Aggregations