diff options
author | Stephane Gamard <stephane.gamard@searchbox.com> | 2014-07-21 10:15:04 +0200 |
---|---|---|
committer | Stephane Gamard <stephane.gamard@searchbox.com> | 2014-07-21 10:15:52 +0200 |
commit | 092e517b5a61cba5a7b9e8cfd0468f0d20e4875b (patch) | |
tree | a31aa1779fa01582614763071fd41777309d2ff9 | |
parent | 881746f43a06fcfa043f94717d07c6288d9f9349 (diff) | |
download | sonarqube-092e517b5a61cba5a7b9e8cfd0468f0d20e4875b.tar.gz sonarqube-092e517b5a61cba5a7b9e8cfd0468f0d20e4875b.zip |
SONAR-5410 - Using sonar.es.node.port properties if set in conf for ES port
-rw-r--r-- | sonar-start/src/main/java/org/sonar/start/StartServer.java | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/sonar-start/src/main/java/org/sonar/start/StartServer.java b/sonar-start/src/main/java/org/sonar/start/StartServer.java index ff46c78eec1..b73171c0e52 100644 --- a/sonar-start/src/main/java/org/sonar/start/StartServer.java +++ b/sonar-start/src/main/java/org/sonar/start/StartServer.java @@ -45,7 +45,6 @@ public final class StartServer { private Monitor monitor; private final Env env; - private final String esPort; private final Map<String, String> properties; private final Thread shutdownHook; @@ -54,7 +53,6 @@ public final class StartServer { public StartServer(Env env, String... args) throws IOException, InterruptedException { this.env = env; - this.esPort = Integer.toString(NetworkUtils.freePort()); this.properties = new HashMap<String, String>(); monitor = new Monitor(); @@ -106,17 +104,24 @@ public final class StartServer { String workingDirectory = env.rootDir().getAbsolutePath(); + String esPort; + if (properties.containsKey("sonar.es.node.port")) { + esPort = properties.get("sonar.es.node.port"); + } else { + esPort = Integer.toString(NetworkUtils.freePort()); + } + // Start ES elasticsearch = new ProcessWrapper( - env.rootDir().getAbsolutePath(), + workingDirectory, sonarProperties.getProperty("sonar.es.java_opts"), "org.sonar.search.ElasticSearch", ImmutableMap.of( "esDebug", properties.containsKey("esDebug") ? properties.get("esDebug") : "false", "esPort", esPort, - "esHome", env.rootDir().getAbsolutePath()), + "esHome", workingDirectory), "ES", - env.rootDir().getAbsolutePath() + "/lib/search/sonar-search-4.5-SNAPSHOT.jar"); + workingDirectory + "/lib/search/sonar-search-4.5-SNAPSHOT.jar"); monitor.registerProcess(elasticsearch); // @@ -160,8 +165,8 @@ public final class StartServer { public static void main(String... args) throws InterruptedException, IOException, URISyntaxException { - //String home = System.getenv(SONAR_HOME); - String home = "/Volumes/data/sonar/sonarqube/sonar-start/target/sonarqube-4.5-SNAPSHOT"; + String home = System.getenv(SONAR_HOME); + //String home = "/Volumes/data/sonar/sonarqube/sonar-start/target/sonarqube-4.5-SNAPSHOT"; //Check if we have a SONAR_HOME if (StringUtils.isEmpty(home)) { |