Sonar can be packaged as a WAR then deployed in an existing JEE server. on Tomcat or Jetty.
Note that you must already know how to deploy a web application in the server of your choice. Check the Requirements page to get the list of the supported servers.
Quick Installation
The SONAR_HOME_PATH will refer below to the path to the directory where the Sonar distribution has been unzipped.
...
- Edit 'SONAR_HOME_PATH/conf/sonar.properties' as described in standalone mode (Note that 'SONAR_HOME_PATH/conf/wrapper.conf' is never used when deploying in application server).
- Execute the script 'SONAR_HOME_PATH/war/build-war.sh' script (or 'SONAR_HOME_PATH/war/build-war.bat' on MS Windows)
- Deploy 'SONAR_HOME_PATH/war/sonar.war' in the application server
- Browse to http://localhost/sonar and follow the setup instructions
Note that:
- the SONAR_HOME_PATH directory cannot be removed
- there is no need to rebuild the WAR when installing/uninstalling plugins or rule extensionsthe WAR file must be rebuilt when a configuration file is updated (directory 'SONAR_HOME_PATH/conf')
- there is no need to rebuild the WAR when installing/uninstalling plugins or rule extensions
the user who runs Tomcat must have read & write access to the SONAR_HOME_DIR directory (to allow plugin installation from the Web admin console for instance)
| Info | ||
|---|---|---|
| ||
| Note that after having upgraded Sonar, it is required to restart the web server. |
Advanced Usage
Moving the Sonar Distribution or Deploying in Another Machine
If for any reason, the SONAR_HOME_PATH has to change (moving the Sonar distribution into another directory, generating the WAR and deploying it on a different machinemachines, etc.), you can override this path SONAR_HOME_PATH by setting the SONAR_HOME environment variable to the new path.
Injecting Environment Variables
You can inject environment variables in the 'sonar.properties' file with the following syntax.
...
This can be quite valuable to better handle production environments.
Increasing Memory Heap Size on Tomcat
A minimum heap size of 512Mb is required. To increase the memory heap size on Tomcat, set the CATALINA_OPTS variable before starting Tomcat:
...

