Fix maven build on Windows
This commit is contained in:
@@ -10,7 +10,7 @@ package org.springframework.ide.vscode.commons.maven;
|
|||||||
* Contributors:
|
* Contributors:
|
||||||
* Pivotal, Inc. - initial API and implementation
|
* Pivotal, Inc. - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -43,8 +43,11 @@ public class DependencyTreeTest {
|
|||||||
*/
|
*/
|
||||||
private static void buildProject(Path testProjectPath) throws Exception {
|
private static void buildProject(Path testProjectPath) throws Exception {
|
||||||
if (!Files.exists(testProjectPath.resolve("classpath.txt"))) {
|
if (!Files.exists(testProjectPath.resolve("classpath.txt"))) {
|
||||||
testProjectPath.resolve("mvnw").toFile().setExecutable(true);
|
Path mvnwPath = System.getProperty("os.name").toLowerCase().startsWith("win")
|
||||||
ExternalProcess process = new ExternalProcess(testProjectPath.toFile(), new ExternalCommand("./mvnw", "clean", "package"), true);
|
? testProjectPath.resolve("mvnw.cmd") : testProjectPath.resolve("mvnw");
|
||||||
|
mvnwPath.toFile().setExecutable(true);
|
||||||
|
ExternalProcess process = new ExternalProcess(testProjectPath.toFile(),
|
||||||
|
new ExternalCommand(mvnwPath.toAbsolutePath().toString(), "clean", "package"), true);
|
||||||
if (process.getExitValue() != 0) {
|
if (process.getExitValue() != 0) {
|
||||||
throw new RuntimeException("Failed to build test project");
|
throw new RuntimeException("Failed to build test project");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,11 +60,14 @@ public class TestProjectHarness {
|
|||||||
public Cache<String, IJavaProject> cache = CacheBuilder.newBuilder().build();
|
public Cache<String, IJavaProject> cache = CacheBuilder.newBuilder().build();
|
||||||
|
|
||||||
public IJavaProject mavenProject(String name) throws Exception {
|
public IJavaProject mavenProject(String name) throws Exception {
|
||||||
Path testProjectPath = Paths.get(TestProjectHarness.class.getResource("/"+name).toURI());
|
Path testProjectPath = Paths.get(TestProjectHarness.class.getResource("/" + name).toURI());
|
||||||
assertTrue(Files.exists(testProjectPath));
|
assertTrue(Files.exists(testProjectPath));
|
||||||
if (!Files.exists(testProjectPath.resolve("classpath.txt"))) {
|
if (!Files.exists(testProjectPath.resolve("classpath.txt"))) {
|
||||||
testProjectPath.resolve("mvnw").toFile().setExecutable(true);
|
Path mvnwPath = System.getProperty("os.name").toLowerCase().startsWith("win")
|
||||||
ExternalProcess process = new ExternalProcess(testProjectPath.toFile(), new ExternalCommand("./mvnw", "clean", "package"), true);
|
? testProjectPath.resolve("mvnw.cmd") : testProjectPath.resolve("mvnw");
|
||||||
|
mvnwPath.toFile().setExecutable(true);
|
||||||
|
ExternalProcess process = new ExternalProcess(testProjectPath.toFile(),
|
||||||
|
new ExternalCommand(mvnwPath.toAbsolutePath().toString(), "clean", "package"), true);
|
||||||
if (process.getExitValue() != 0) {
|
if (process.getExitValue() != 0) {
|
||||||
throw new RuntimeException("Failed to build test project");
|
throw new RuntimeException("Failed to build test project");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user