io.committed.speedy.hook.util.MavenUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of speedy-spotless-maven-plugin Show documentation
Show all versions of speedy-spotless-maven-plugin Show documentation
For easy formatting of staged changes.
package io.committed.speedy.hook.util;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
* Created on 02/11/17.
*
* @author Reda.Housni-Alaoui
*/
public class MavenUtils {
private static final String MAVEN_HOME_PROP = "maven.home";
private static final String BIN_MVN = "bin/mvn";
public Path getMavenExecutable() {
Path mavenHome = Paths.get(System.getProperty(MAVEN_HOME_PROP));
Path executable = mavenHome.resolve(BIN_MVN);
if (!Files.exists(executable)) {
throw new RuntimeException(
"Could not find maven executable. " + executable + " does not exist.");
}
return executable;
}
}