/** * Returns an execution command to launch Maven. If Maven home environment variable isn't set then * 'mvn' will be returned since it's assumed that 'mvn' should be in PATH variable. * * @return an execution command to launch Maven */ public static String getMavenExecCommand() { final java.io.File mvnHome = getMavenHome(); if (mvnHome != null) { final String mvn = "bin" + java.io.File.separatorChar + "mvn"; return new java.io.File(mvnHome, mvn) .getAbsolutePath(); // use Maven home directory if it's set } else { return "mvn"; // otherwise 'mvn' should be in PATH variable } }