javaExecutable = new Os().thisJavaExe().getAbsolutePath();
}
Command command = Command.builder()
- .setExecutable(javaExecutable)
- .addEnvVariables(jvmEnvVariables)
- .addArguments(jvmArguments)
- .addArguments("-cp", jarFile.getAbsolutePath(), BatchLauncherMain.class.getName(), propertiesFile.getAbsolutePath())
- .build();
+ .setExecutable(javaExecutable)
+ .addEnvVariables(jvmEnvVariables)
+ .addArguments(jvmArguments)
+ .addArguments("-cp", jarFile.getAbsolutePath(), BatchLauncherMain.class.getName(), propertiesFile.getAbsolutePath())
+ .build();
return new ForkCommand(command, jarFile, propertiesFile);
}
private void fork(ForkCommand forkCommand) {
if (stdOut == null) {
stdOut = new PrintStreamConsumer(System.out);
- stdOut = new PrintStreamConsumer(System.out);
- stdOut = new PrintStreamConsumer(System.out);
- stdOut = new PrintStreamConsumer(System.out);
- stdOut = new PrintStreamConsumer(System.out);
}
if (stdErr == null) {
stdErr = new PrintStreamConsumer(System.err);
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.text.MessageFormat;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
private static final String PROPERTY_MODULES = "sonar.modules";
private static final String PROPERTY_PROJECT_BASEDIR = "sonar.projectBaseDir";
private static final String PROPERTY_PROJECT_CONFIG_FILE = "sonar.projectConfigFile";
+ private static final String SONAR_PROJECT_PROPERTIES_FILENAME = "sonar-project.properties";
private final Cli cli;
private Properties loadProjectProperties() throws IOException {
Properties cliProps = cli.properties();
- File rootSettingsFile = locatePropertiesFile(cliProps, cliProps.containsKey(PROPERTY_PROJECT_BASEDIR) ? PROPERTY_PROJECT_BASEDIR : PROJECT_HOME, "sonar-project.properties",
+ File rootSettingsFile = locatePropertiesFile(cliProps, cliProps.containsKey(PROPERTY_PROJECT_BASEDIR) ? PROPERTY_PROJECT_BASEDIR : PROJECT_HOME,
+ SONAR_PROJECT_PROPERTIES_FILENAME,
PROJECT_SETTINGS);
if (rootSettingsFile != null && rootSettingsFile.isFile() && rootSettingsFile.exists()) {
Logs.info("Project configuration file: " + rootSettingsFile.getAbsolutePath());
}
} else if (moduleProps.containsKey(PROPERTY_PROJECT_CONFIG_FILE)) {
baseDir = loadPropsFile(parentBaseDir, moduleProps, moduleId);
+ setProjectBaseDir(baseDir, moduleProps, moduleId);
moduleProps.remove(PROPERTY_PROJECT_CONFIG_FILE);
} else {
baseDir = new File(parentBaseDir, moduleId);
private static void setProjectBaseDir(File baseDir, Properties childProps, String moduleId) {
if (!baseDir.isDirectory()) {
- throw new IllegalStateException("The base directory of the module '" + moduleId + "' does not exist: " + baseDir.getAbsolutePath());
+ throw new IllegalStateException(MessageFormat.format("The base directory of the module ''{0}'' does not exist: {1}", moduleId, baseDir.getAbsolutePath()));
}
childProps.put(PROPERTY_PROJECT_BASEDIR, baseDir.getAbsolutePath());
}
}
private void tryToFindAndLoadPropsFile(File baseDir, Properties moduleProps, String moduleId) {
- File propertyFile = new File(baseDir, "sonar-project.properties");
+ File propertyFile = new File(baseDir, SONAR_PROJECT_PROPERTIES_FILENAME);
if (propertyFile.isFile()) {
Properties propsFromFile = toProperties(propertyFile);
for (Entry<Object, Object> entry : propsFromFile.entrySet()) {