---
## Running SonarQube as a Service on Windows
-
### Install or Uninstall SonarQube as a Service
```
}
from(file('src/main/assembly')) {
exclude 'conf/sonar.properties'
- exclude 'bin/windows-x86-64/lib/SonarServiceWrapper.xml'
+ exclude 'bin/windows-x86-64/lib/SonarServiceWrapperTemplate.xml'
exclude 'bin/windows-x86-64/StartSonar.bat'
exclude 'elasticsearch-patch'
exclude 'bin/linux-x86-64/sonar.sh'
}
into("${archiveDir}/bin/windows-x86-64/lib/") {
- from file('src/main/assembly/bin/windows-x86-64/lib/SonarServiceWrapper.xml')
+ from file('src/main/assembly/bin/windows-x86-64/lib/SonarServiceWrapperTemplate.xml')
filter(ReplaceTokens, tokens: [
'sqversion': version
])
rem check if Java is found
set JAVA_EXE=
call "%REALPATH%lib\find_java.bat" set_java_exe FAIL || goto:eof
+rem replace JAVA_EXE with the Java path in configuration file
+powershell -Command "(Get-Content %REALPATH%lib\SonarServiceWrapperTemplate.xml) -replace 'JAVA_EXE', '%JAVA_EXE%' | Out-File -encoding ASCII %REALPATH%lib\SonarServiceWrapper.xml"
rem call the SonarServiceWrapper.exe passing all the parameters
"%REALPATH%lib\SonarServiceWrapper.exe" %*
+++ /dev/null
-<!--
- ~ SonarQube
- ~ Copyright (C) 2009-2022 SonarSource SA
- ~ mailto:info AT sonarsource DOT com
- ~
- ~ This program is free software; you can redistribute it and/or
- ~ modify it under the terms of the GNU Lesser General Public
- ~ License as published by the Free Software Foundation; either
- ~ version 3 of the License, or (at your option) any later version.
- ~
- ~ This program is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public License
- ~ along with this program; if not, write to the Free Software Foundation,
- ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- -->
-
-<service>
- <!-- Path to the Java executable -->
- <executable>%JAVA_EXE%</executable>
-
- <!-- DO NOT EDIT THE FOLLOWING SECTIONS -->
- <arguments>
- -Xms8m -Xmx32m
- -Djava.awt.headless=true
- --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED
- --add-opens=java.base/java.lang=ALL-UNNAMED
- --add-opens=java.base/java.nio=ALL-UNNAMED
- --add-opens=java.base/sun.nio.ch=ALL-UNNAMED
- --add-opens=java.management/sun.management=ALL-UNNAMED
- --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED
- -cp "..\..\..\lib\sonar-application-@sqversion@.jar" "org.sonar.application.App"
- </arguments>
-
- <id>SonarQube</id>
- <name>SonarQube</name>
- <description>SonarQube</description>
-
- <logpath>../../../logs</logpath>
- <log mode="none"/>
-
-</service>
\ No newline at end of file
--- /dev/null
+<!--
+ ~ SonarQube
+ ~ Copyright (C) 2009-2022 SonarSource SA
+ ~ mailto:info AT sonarsource DOT com
+ ~
+ ~ This program is free software; you can redistribute it and/or
+ ~ modify it under the terms of the GNU Lesser General Public
+ ~ License as published by the Free Software Foundation; either
+ ~ version 3 of the License, or (at your option) any later version.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this program; if not, write to the Free Software Foundation,
+ ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ -->
+
+<service>
+ <!-- Path to the Java executable. To be replaced by SonarService.bat script -->
+ <executable>JAVA_EXE</executable>
+
+ <!-- DO NOT EDIT THE FOLLOWING SECTIONS -->
+ <arguments>
+ -Xms8m -Xmx32m
+ -Djava.awt.headless=true
+ --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED
+ --add-opens=java.base/java.lang=ALL-UNNAMED
+ --add-opens=java.base/java.nio=ALL-UNNAMED
+ --add-opens=java.base/sun.nio.ch=ALL-UNNAMED
+ --add-opens=java.management/sun.management=ALL-UNNAMED
+ --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED
+ -cp "..\..\..\lib\sonar-application-@sqversion@.jar" "org.sonar.application.App"
+ </arguments>
+
+ <id>SonarQube</id>
+ <name>SonarQube</name>
+ <description>SonarQube</description>
+
+ <logpath>../../../logs</logpath>
+ <log mode="none"/>
+
+</service>
\ No newline at end of file