c35048b7522765352a3ce1fddcfa248fe63027e8
[any23.git] / service / src / main / bin / any23server.bat
1 @REM ----------------------------------------------------------------------------
2 @REM Licensed to the Apache Software Foundation (ASF) under one or more
3 @REM contributor license agreements. See the NOTICE file distributed with
4 @REM this work for additional information regarding copyright ownership.
5 @REM The ASF licenses this file to You under the Apache License, Version 2.0
6 @REM (the "License"); you may not use this file except in compliance with
7 @REM the License. You may obtain a copy of the License at
8
9 @REM http://www.apache.org/licenses/LICENSE-2.0
10
11 @REM Unless required by applicable law or agreed to in writing, software
12 @REM distributed under the License is distributed on an "AS IS" BASIS,
13 @REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 @REM See the License for the specific language governing permissions and
15 @REM limitations under the License.
16 @REM ----------------------------------------------------------------------------
17 @REM
18
19 @echo off
20
21 set ERROR_CODE=0
22
23 :init
24 @REM Decide how to startup depending on the version of windows
25
26 @REM -- Win98ME
27 if NOT "%OS%"=="Windows_NT" goto Win9xArg
28
29 @REM set local scope for the variables with windows NT shell
30 if "%OS%"=="Windows_NT" @setlocal
31
32 @REM -- 4NT shell
33 if "%eval[2+2]" == "4" goto 4NTArgs
34
35 @REM -- Regular WinNT shell
36 set CMD_LINE_ARGS=%*
37 goto WinNTGetScriptDir
38
39 @REM The 4NT Shell from jp software
40 :4NTArgs
41 set CMD_LINE_ARGS=%$
42 goto WinNTGetScriptDir
43
44 :Win9xArg
45 @REM Slurp the command line arguments. This loop allows for an unlimited number
46 @REM of arguments (up to the command line limit, anyway).
47 set CMD_LINE_ARGS=
48 :Win9xApp
49 if %1a==a goto Win9xGetScriptDir
50 set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
51 shift
52 goto Win9xApp
53
54 :Win9xGetScriptDir
55 set SAVEDIR=%CD%
56 %0\
57 cd %0\..\..
58 set BASEDIR=%CD%
59 cd %SAVEDIR%
60 set SAVE_DIR=
61 goto repoSetup
62
63 :WinNTGetScriptDir
64 set BASEDIR=%~dp0\..
65
66 :repoSetup
67
68
69 if "%JAVACMD%"=="" set JAVACMD=java
70
71 if "%REPO%"=="" set REPO=%BASEDIR%\lib
72
73 set EXTRA_JVM_ARGUMENTS=-Xms500m -Xmx500m -XX:PermSize=128m -XX:-UseGCOverheadLimit
74 goto endInit
75
76 @REM Reaching here means variables are defined and arguments have been captured
77 :endInit
78
79 %JAVACMD% %JAVA_OPTS% %EXTRA_JVM_ARGUMENTS% -jar "%REPO%"/jetty-runner-${jetty.runner.version}.jar --path /${project.artifactId} "%REPO%"/${project.build.finalName}.${project.packaging}
80 if ERRORLEVEL 1 goto error
81 goto end
82
83 :error
84 if "%OS%"=="Windows_NT" @endlocal
85 set ERROR_CODE=1
86
87 :end
88 @REM set local scope for the variables with windows NT shell
89 if "%OS%"=="Windows_NT" goto endNT
90
91 @REM For old DOS remove the set variables from ENV - we assume they were not set
92 @REM before we started - at least we don't leave any baggage around
93 set CMD_LINE_ARGS=
94 goto postExec
95
96 :endNT
97 @endlocal
98
99 :postExec
100
101 if "%FORCE_EXIT_ON_ERROR%" == "on" (
102 if %ERROR_CODE% NEQ 0 exit %ERROR_CODE%
103 )
104
105 exit /B %ERROR_CODE%