in maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/BootstrapMojo.java [106:157]
private void runGoals(String relativePathProjectDirectory) throws MojoExecutionException {
Commandline cl = new Commandline();
try {
cl.addSystemEnvironment();
} catch (Exception e) {
throw new MojoExecutionException("Can't add system environment variables to mvn command line.", e);
}
cl.addEnvironment("MAVEN_TERMINATE_CMD", "on");
if (this.mavenHome == null) {
cl.setExecutable("mvn"); // none windows only
} else {
String mvnPath = this.mavenHome.getAbsolutePath() + "/bin/mvn";
if (Os.isFamily("windows")) {
String winMvnPath = mvnPath + ".cmd";
if (!new File(winMvnPath).exists()) {
winMvnPath = mvnPath + ".bat";
}
mvnPath = winMvnPath;
}
cl.setExecutable(mvnPath);
}
cl.setWorkingDirectory(determineWorkingDirectoryPath(
this.getCheckoutDirectory(), //
relativePathProjectDirectory,
goalsDirectory));
if (this.goals != null) {
String[] tokens = StringUtils.split(this.goals, ", ");
for (int i = 0; i < tokens.length; ++i) {
cl.createArg().setValue(tokens[i]);
}
}
if (!(this.profiles == null || this.profiles.isEmpty())) {
cl.createArg().setValue("-P" + this.profiles);
}
StreamConsumer consumer = new DefaultConsumer();
try {
int result = CommandLineUtils.executeCommandLine(cl, consumer, consumer);
if (result != 0) {
throw new MojoExecutionException("Result of mvn execution is: \'" + result + "\'. Release failed.");
}
} catch (CommandLineException e) {
throw new MojoExecutionException("Can't run goal " + goals, e);
}
}