diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2013-09-11 23:12:04 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2013-09-11 23:12:04 +0200 |
commit | 121e0e53c4ae03316fef35410700c9752c77c566 (patch) | |
tree | 6a1dacba61a0914f014d66047b26a2c5422b2796 /sonar-server | |
parent | 0ab2483728249b9dd2c29fc9dc4ecaaee1ef52b3 (diff) | |
download | sonarqube-121e0e53c4ae03316fef35410700c9752c77c566.tar.gz sonarqube-121e0e53c4ae03316fef35410700c9752c77c566.zip |
SONAR-4577 End of support of WAR deployment mode
Diffstat (limited to 'sonar-server')
3 files changed, 11 insertions, 34 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/platform/SonarHome.java b/sonar-server/src/main/java/org/sonar/server/platform/SonarHome.java index a830ccc758f..b6962dfb593 100644 --- a/sonar-server/src/main/java/org/sonar/server/platform/SonarHome.java +++ b/sonar-server/src/main/java/org/sonar/server/platform/SonarHome.java @@ -22,19 +22,14 @@ package org.sonar.server.platform; import com.google.common.base.Supplier; import com.google.common.base.Suppliers; import org.apache.commons.lang.StringUtils; -import org.sonar.core.config.ConfigurationUtils; import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.Properties; /** * Search fo the Sonar installation directory in the following ordered steps : * <ol> - * <li>system property SONAR_HOME</li> - * <li>environment variable SONAR_HOME</li> - * <li>property SONAR_HOME in the file WEB-INF/classes/sonar-war.properties</li> + * <li>system property SONAR_HOME</li> + * <li>environment variable SONAR_HOME</li> * </ol> * * @since 2.12 @@ -45,11 +40,12 @@ final class SonarHome { // only static methods } - static final String PROPERTY = "SONAR_HOME"; + static final String SONAR_HOME = "SONAR_HOME"; + static Supplier<File> homeSupplier = Suppliers.memoize(new Supplier<File>() { public File get() { File home = locate(); - System.setProperty(PROPERTY, home.getAbsolutePath()); + System.setProperty(SONAR_HOME, home.getAbsolutePath()); return home; } }); @@ -59,34 +55,20 @@ final class SonarHome { } static File locate() { - String value = System.getProperty(PROPERTY); + String value = System.getProperty(SONAR_HOME); if (StringUtils.isBlank(value)) { - value = System.getenv(PROPERTY); - if (StringUtils.isBlank(value)) { - value = openWarProperties().getProperty(PROPERTY); - } + value = System.getenv(SONAR_HOME); } if (StringUtils.isBlank(value)) { - throw new IllegalStateException("SonarQube value is not defined. " + - "Please set the environment variable/system property " + PROPERTY + " or edit the file WEB-INF/classes/sonar-war.properties"); + throw new IllegalStateException("The system property or env variable " + SONAR_HOME + " is not set"); } File dir = new File(value); if (!dir.isDirectory() || !dir.exists()) { - throw new IllegalStateException(PROPERTY + " is not valid: " + value + ". Please fix the environment variable/system property SONAR_HOME or " + - "the file WEB-INF/classes/sonar-war.properties"); + throw new IllegalStateException(SONAR_HOME + " is not valid: " + value + ". Please fix the env variable/system " + + "property " + SONAR_HOME); } return dir; } - - private static Properties openWarProperties() { - try { - InputStream input = SonarHome.class.getResourceAsStream("/sonar-war.properties"); - // it closes the stream - return ConfigurationUtils.readInputStream(input); - } catch (IOException e) { - throw new IllegalStateException("Fail to load the file sonar-war.properties", e); - } - } } diff --git a/sonar-server/src/main/resources/sonar-war.properties b/sonar-server/src/main/resources/sonar-war.properties deleted file mode 100644 index de2350c3887..00000000000 --- a/sonar-server/src/main/resources/sonar-war.properties +++ /dev/null @@ -1,5 +0,0 @@ -# This file is used only when deploying the webapp to an application server. -# It is ignored when using the standalone mode shipped by default. - -# Path to Sonar installation directory, if the environment variable/system property SONAR_HOME is not defined -#SONAR_HOME=
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/config/environment.rb b/sonar-server/src/main/webapp/WEB-INF/config/environment.rb index 3d6ea3cf3d1..b12dbade299 100644 --- a/sonar-server/src/main/webapp/WEB-INF/config/environment.rb +++ b/sonar-server/src/main/webapp/WEB-INF/config/environment.rb @@ -9,7 +9,7 @@ require File.join(File.dirname(__FILE__), 'boot') require 'color' # Disable all the warnings : -# Gem::SourceIndex#initialize called from /.../war/sonar-server/WEB-INF/gems/gems/rails-2.3.15/lib/rails/vendor_gem_source_index.rb:100. +# Gem::SourceIndex#initialize called from /.../web/WEB-INF/gems/gems/rails-2.3.15/lib/rails/vendor_gem_source_index.rb:100. # The other solutions are to upgrade to rails 3 or to use gembundler.com require 'rubygems' Gem::Deprecate.skip = (RAILS_ENV == 'production') |