aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-application/src
diff options
context:
space:
mode:
authorDimitris Kavvathas <dimitris.kavvathas@sonarsource.com>2022-08-03 10:26:49 +0200
committersonartech <sonartech@sonarsource.com>2022-08-05 20:03:27 +0000
commit4d2d50a716507d02c04dfa8a5885415a8116c213 (patch)
tree7f47956fe21c865608d44f90a8e81af89d0a74aa /sonar-application/src
parent14cf47a4180798e8f76eeaf7e297f4be96428107 (diff)
downloadsonarqube-4d2d50a716507d02c04dfa8a5885415a8116c213.tar.gz
sonarqube-4d2d50a716507d02c04dfa8a5885415a8116c213.zip
SONAR-17137 Replace JSW with WinSW for running SQ on Windows
Diffstat (limited to 'sonar-application/src')
-rw-r--r--sonar-application/src/main/assembly/bin/windows-x86-64/SonarService.exebin0 -> 655872 bytes
-rw-r--r--sonar-application/src/main/assembly/bin/windows-x86-64/SonarService.xml25
-rwxr-xr-xsonar-application/src/main/assembly/bin/windows-x86-64/StartNTService.bat50
-rwxr-xr-xsonar-application/src/main/assembly/bin/windows-x86-64/StartSonar.bat114
-rwxr-xr-xsonar-application/src/main/assembly/bin/windows-x86-64/StopNTService.bat50
-rwxr-xr-xsonar-application/src/main/assembly/bin/windows-x86-64/lib/wrapper.dllbin76800 -> 0 bytes
-rwxr-xr-xsonar-application/src/main/assembly/bin/windows-x86-64/wrapper.exebin220672 -> 0 bytes
-rwxr-xr-xsonar-application/src/main/assembly/bin/winsw-license/LICENSE.txt26
8 files changed, 110 insertions, 155 deletions
diff --git a/sonar-application/src/main/assembly/bin/windows-x86-64/SonarService.exe b/sonar-application/src/main/assembly/bin/windows-x86-64/SonarService.exe
new file mode 100644
index 00000000000..21926362c2d
--- /dev/null
+++ b/sonar-application/src/main/assembly/bin/windows-x86-64/SonarService.exe
Binary files differ
diff --git a/sonar-application/src/main/assembly/bin/windows-x86-64/SonarService.xml b/sonar-application/src/main/assembly/bin/windows-x86-64/SonarService.xml
new file mode 100644
index 00000000000..0aaa9bc0609
--- /dev/null
+++ b/sonar-application/src/main/assembly/bin/windows-x86-64/SonarService.xml
@@ -0,0 +1,25 @@
+<service>
+ <!-- Path to the Java executable -->
+ <executable>java</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
diff --git a/sonar-application/src/main/assembly/bin/windows-x86-64/StartNTService.bat b/sonar-application/src/main/assembly/bin/windows-x86-64/StartNTService.bat
deleted file mode 100755
index a8bc27a062f..00000000000
--- a/sonar-application/src/main/assembly/bin/windows-x86-64/StartNTService.bat
+++ /dev/null
@@ -1,50 +0,0 @@
-@echo off
-setlocal
-
-rem Copyright (c) 1999, 2006 Tanuki Software Inc.
-rem
-rem Java Service Wrapper general NT service start script
-rem
-
-if "%OS%"=="Windows_NT" goto nt
-echo This script only works with NT-based versions of Windows.
-goto :eof
-
-:nt
-rem
-rem Find the application home.
-rem
-rem %~dp0 is location of current script under NT
-set _REALPATH=%~dp0
-
-rem Decide on the wrapper binary.
-set _WRAPPER_BASE=wrapper
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe
-if exist "%_WRAPPER_EXE%" goto conf
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe
-if exist "%_WRAPPER_EXE%" goto conf
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%.exe
-if exist "%_WRAPPER_EXE%" goto conf
-echo Unable to locate a Wrapper executable using any of the following names:
-echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe
-echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe
-echo %_REALPATH%%_WRAPPER_BASE%.exe
-pause
-goto :eof
-
-rem
-rem Find the wrapper.conf
-rem
-:conf
-set _WRAPPER_CONF="%~f1"
-if not %_WRAPPER_CONF%=="" goto startup
-set _WRAPPER_CONF="%_REALPATH%..\..\conf\wrapper.conf"
-
-rem
-rem Start the Wrapper NT service.
-rem
-:startup
-"%_WRAPPER_EXE%" -t %_WRAPPER_CONF%
-if not errorlevel 1 goto :eof
-pause
-
diff --git a/sonar-application/src/main/assembly/bin/windows-x86-64/StartSonar.bat b/sonar-application/src/main/assembly/bin/windows-x86-64/StartSonar.bat
index 8a5c96f1dd7..3214ab5ea1a 100755
--- a/sonar-application/src/main/assembly/bin/windows-x86-64/StartSonar.bat
+++ b/sonar-application/src/main/assembly/bin/windows-x86-64/StartSonar.bat
@@ -1,55 +1,59 @@
-@echo off
-setlocal
-
-rem Copyright (c) 1999, 2006 Tanuki Software Inc.
-rem
-rem Java Service Wrapper general startup script
-rem
-
-rem
-rem Resolve the real path of the wrapper.exe
-rem For non NT systems, the _REALPATH and _WRAPPER_CONF values
-rem can be hard-coded below and the following test removed.
-rem
-if "%OS%"=="Windows_NT" goto nt
-echo This script only works with NT-based versions of Windows.
-goto :eof
-
-:nt
-rem
-rem Find the application home.
-rem
-rem %~dp0 is location of current script under NT
-set _REALPATH=%~dp0
-
-rem Decide on the wrapper binary.
-set _WRAPPER_BASE=wrapper
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe
-if exist "%_WRAPPER_EXE%" goto conf
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe
-if exist "%_WRAPPER_EXE%" goto conf
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%.exe
-if exist "%_WRAPPER_EXE%" goto conf
-echo Unable to locate a Wrapper executable using any of the following names:
-echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe
-echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe
-echo %_REALPATH%%_WRAPPER_BASE%.exe
-pause
-goto :eof
-
-rem
-rem Find the wrapper.conf
-rem
-:conf
-set _WRAPPER_CONF="%~f1"
-if not %_WRAPPER_CONF%=="" goto startup
-set _WRAPPER_CONF="%_REALPATH%..\..\conf\wrapper.conf"
-
-rem
-rem Start the Wrapper
-rem
-:startup
-"%_WRAPPER_EXE%" -c %_WRAPPER_CONF%
-if not errorlevel 1 goto :eof
-pause
-
+@rem SonarQube
+@rem Copyright (C) 2009-2022 SonarSource SA
+@rem mailto:info AT sonarsource DOT com
+@rem
+@rem This program is free software; you can redistribute it and/or
+@rem modify it under the terms of the GNU Lesser General Public
+@rem License as published by the Free Software Foundation; either
+@rem version 3 of the License, or (at your option) any later version.
+@rem
+@rem This program is distributed in the hope that it will be useful,
+@rem but WITHOUT ANY WARRANTY; without even the implied warranty of
+@rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+@rem Lesser General Public License for more details.
+@rem
+@rem You should have received a copy of the GNU Lesser General Public License
+@rem along with this program; if not, write to the Free Software Foundation,
+@rem Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+@echo off
+setlocal
+
+rem Path to the Java executable
+set JAVA_EXE="java"
+
+
+rem DO NOT EDIT THE FOLLOWING SECTIONS
+call :check_if_sonar_is_running FAIL || goto:eof
+
+%JAVA_EXE% -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"
+
+goto:eof
+
+:check_if_sonar_is_running
+set "SQ_PROCESS="
+where jps >nul 2>nul
+if %errorlevel% equ 0 (
+ rem give priority to jps command if present
+ for /f "tokens=1" %%i in ('jps -l ^| findstr "org.sonar.application.App"') do set "SQ_PROCESS=%%i"
+) else (
+ rem fallback to wmic command
+ for /f "tokens=2" %%i in ('wmic process where "name='java.exe' and commandline like '%%org.sonar.application.App%%'" get name^, processid 2^>nul ^| findstr "java"') do set "SQ_PROCESS=%%i"
+)
+
+if not [%SQ_PROCESS%]==[] (
+ echo ERROR: Another instance of the SonarQube application is already running with PID %SQ_PROCESS%
+ exit /b 1
+)
+goto:eof
+
+endlocal
+
diff --git a/sonar-application/src/main/assembly/bin/windows-x86-64/StopNTService.bat b/sonar-application/src/main/assembly/bin/windows-x86-64/StopNTService.bat
deleted file mode 100755
index bf4b3ef4d38..00000000000
--- a/sonar-application/src/main/assembly/bin/windows-x86-64/StopNTService.bat
+++ /dev/null
@@ -1,50 +0,0 @@
-@echo off
-setlocal
-
-rem Copyright (c) 1999, 2006 Tanuki Software Inc.
-rem
-rem Java Service Wrapper general NT service stop script
-rem
-
-if "%OS%"=="Windows_NT" goto nt
-echo This script only works with NT-based versions of Windows.
-goto :eof
-
-:nt
-rem
-rem Find the application home.
-rem
-rem %~dp0 is location of current script under NT
-set _REALPATH=%~dp0
-
-rem Decide on the wrapper binary.
-set _WRAPPER_BASE=wrapper
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe
-if exist "%_WRAPPER_EXE%" goto conf
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe
-if exist "%_WRAPPER_EXE%" goto conf
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%.exe
-if exist "%_WRAPPER_EXE%" goto conf
-echo Unable to locate a Wrapper executable using any of the following names:
-echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe
-echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe
-echo %_REALPATH%%_WRAPPER_BASE%.exe
-pause
-goto :eof
-
-rem
-rem Find the wrapper.conf
-rem
-:conf
-set _WRAPPER_CONF="%~f1"
-if not %_WRAPPER_CONF%=="" goto startup
-set _WRAPPER_CONF="%_REALPATH%..\..\conf\wrapper.conf"
-
-rem
-rem Stop the Wrapper NT service.
-rem
-:startup
-"%_WRAPPER_EXE%" -p %_WRAPPER_CONF%
-if not errorlevel 1 goto :eof
-pause
-
diff --git a/sonar-application/src/main/assembly/bin/windows-x86-64/lib/wrapper.dll b/sonar-application/src/main/assembly/bin/windows-x86-64/lib/wrapper.dll
deleted file mode 100755
index f07fc9e582b..00000000000
--- a/sonar-application/src/main/assembly/bin/windows-x86-64/lib/wrapper.dll
+++ /dev/null
Binary files differ
diff --git a/sonar-application/src/main/assembly/bin/windows-x86-64/wrapper.exe b/sonar-application/src/main/assembly/bin/windows-x86-64/wrapper.exe
deleted file mode 100755
index db2dddae8c4..00000000000
--- a/sonar-application/src/main/assembly/bin/windows-x86-64/wrapper.exe
+++ /dev/null
Binary files differ
diff --git a/sonar-application/src/main/assembly/bin/winsw-license/LICENSE.txt b/sonar-application/src/main/assembly/bin/winsw-license/LICENSE.txt
new file mode 100755
index 00000000000..54c10724e0c
--- /dev/null
+++ b/sonar-application/src/main/assembly/bin/winsw-license/LICENSE.txt
@@ -0,0 +1,26 @@
+This bundle contains Windows Service Wrapper scripts and binaries version 2.11.0 published
+under the following license:
+
+ MIT License
+
+ Copyright (c) 2008-2020 Kohsuke Kawaguchi, Sun Microsystems, Inc., CloudBees, Inc., Oleg Nenashev and other contributors
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+
+ https://github.com/winsw/winsw/blob/master/LICENSE.txt