PageRenderTime 50ms CodeModel.GetById 15ms app.highlight 26ms RepoModel.GetById 2ms app.codeStats 0ms

/maven/bin/mvnDebug.bat

https://github.com/ajakubo1/opennms
Batch | 199 lines | 158 code | 41 blank | 0 comment | 38 complexity | a4fc652916bb0174e045266c4e94a7df MD5 | raw file
  1@REM ----------------------------------------------------------------------------
  2@REM Licensed to the Apache Software Foundation (ASF) under one
  3@REM or more contributor license agreements.  See the NOTICE file
  4@REM distributed with this work for additional information
  5@REM regarding copyright ownership.  The ASF licenses this file
  6@REM to you under the Apache License, Version 2.0 (the
  7@REM "License"); you may not use this file except in compliance
  8@REM with the License.  You may obtain a copy of the License at
  9@REM
 10@REM    http://www.apache.org/licenses/LICENSE-2.0
 11@REM
 12@REM Unless required by applicable law or agreed to in writing,
 13@REM software distributed under the License is distributed on an
 14@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 15@REM KIND, either express or implied.  See the License for the
 16@REM specific language governing permissions and limitations
 17@REM under the License.
 18@REM ----------------------------------------------------------------------------
 19
 20@REM ----------------------------------------------------------------------------
 21@REM Maven2 Start Up Batch script
 22@REM
 23@REM Required ENV vars:
 24@REM JAVA_HOME - location of a JDK home dir
 25@REM
 26@REM Optional ENV vars
 27@REM M2_HOME - location of maven2's installed home dir
 28@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
 29@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
 30@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
 31@REM     e.g. to debug Maven itself, use
 32@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
 33@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
 34@REM ----------------------------------------------------------------------------
 35
 36@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
 37@echo off
 38@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
 39@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%
 40
 41@echo Preparing to Execute Maven in Debug Mode
 42
 43@REM set %HOME% to equivalent of $HOME
 44if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
 45
 46@REM Execute a user defined script before this one
 47if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
 48if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
 49:skipRcPre
 50
 51set ERROR_CODE=0
 52
 53@REM set local scope for the variables with windows NT shell
 54if "%OS%"=="Windows_NT" @setlocal
 55if "%OS%"=="WINNT" @setlocal
 56
 57set MAVEN_DEBUG_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
 58
 59@REM ==== START VALIDATION ====
 60if not "%JAVA_HOME%" == "" goto OkJHome
 61
 62echo.
 63echo Error: JAVA_HOME not found in your environment. >&2
 64echo Please set the JAVA_HOME variable in your environment to match the >&2
 65echo location of your Java installation >&2
 66echo.
 67goto error
 68
 69:OkJHome
 70if exist "%JAVA_HOME%\bin\java.exe" goto chkMHome
 71
 72echo.
 73echo Error: JAVA_HOME is set to an invalid directory. >&2
 74echo JAVA_HOME = "%JAVA_HOME%" >&2
 75echo Please set the JAVA_HOME variable in your environment to match the >&2
 76echo location of your Java installation >&2
 77echo.
 78goto error
 79
 80:chkMHome
 81if not "%M2_HOME%"=="" goto valMHome
 82
 83if "%OS%"=="Windows_NT" SET "M2_HOME=%~dp0.."
 84if "%OS%"=="WINNT" SET "M2_HOME=%~dp0.."
 85if not "%M2_HOME%"=="" goto valMHome
 86
 87echo.
 88echo Error: M2_HOME not found in your environment. >&2
 89echo Please set the M2_HOME variable in your environment to match the >&2
 90echo location of the Maven installation >&2
 91echo.
 92goto error
 93
 94:valMHome
 95
 96:stripMHome
 97if not "_%M2_HOME:~-1%"=="_\" goto checkMBat
 98set "M2_HOME=%M2_HOME:~0,-1%"
 99goto stripMHome
100
101:checkMBat
102if exist "%M2_HOME%\bin\mvn.bat" goto init
103
104echo.
105echo Error: M2_HOME is set to an invalid directory. >&2
106echo M2_HOME = "%M2_HOME%" >&2
107echo Please set the M2_HOME variable in your environment to match the >&2
108echo location of the Maven installation >&2
109echo.
110goto error
111@REM ==== END VALIDATION ====
112
113:init
114@REM Decide how to startup depending on the version of windows
115
116@REM -- Windows NT with Novell Login
117if "%OS%"=="WINNT" goto WinNTNovell
118
119@REM -- Win98ME
120if NOT "%OS%"=="Windows_NT" goto Win9xArg
121
122:WinNTNovell
123
124@REM -- 4NT shell
125if "%@eval[2+2]" == "4" goto 4NTArgs
126
127@REM -- Regular WinNT shell
128set MAVEN_CMD_LINE_ARGS=%*
129goto endInit
130
131@REM The 4NT Shell from jp software
132:4NTArgs
133set MAVEN_CMD_LINE_ARGS=%$
134goto endInit
135
136:Win9xArg
137@REM Slurp the command line arguments.  This loop allows for an unlimited number
138@REM of agruments (up to the command line limit, anyway).
139set MAVEN_CMD_LINE_ARGS=
140:Win9xApp
141if %1a==a goto endInit
142set MAVEN_CMD_LINE_ARGS=%MAVEN_CMD_LINE_ARGS% %1
143shift
144goto Win9xApp
145
146@REM Reaching here means variables are defined and arguments have been captured
147:endInit
148SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
149
150@REM -- 4NT shell
151if "%@eval[2+2]" == "4" goto 4NTCWJars
152
153@REM -- Regular WinNT shell
154for %%i in ("%M2_HOME%"\boot\plexus-classworlds-*) do set CLASSWORLDS_JAR="%%i"
155goto runm2
156
157@REM The 4NT Shell from jp software
158:4NTCWJars
159for %%i in ("%M2_HOME%\boot\plexus-classworlds-*") do set CLASSWORLDS_JAR="%%i"
160goto runm2
161
162@REM Start MAVEN2
163:runm2
164set CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
165%MAVEN_JAVA_EXE% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %CLASSWORLDS_JAR% "-Dclassworlds.conf=%M2_HOME%\bin\m2.conf" "-Dmaven.home=%M2_HOME%" %CLASSWORLDS_LAUNCHER% %MAVEN_CMD_LINE_ARGS%
166if ERRORLEVEL 1 goto error
167goto end
168
169:error
170if "%OS%"=="Windows_NT" @endlocal
171if "%OS%"=="WINNT" @endlocal
172set ERROR_CODE=1
173
174:end
175@REM set local scope for the variables with windows NT shell
176if "%OS%"=="Windows_NT" goto endNT
177if "%OS%"=="WINNT" goto endNT
178
179@REM For old DOS remove the set variables from ENV - we assume they were not set
180@REM before we started - at least we don't leave any baggage around
181set MAVEN_JAVA_EXE=
182set MAVEN_CMD_LINE_ARGS=
183goto postExec
184
185:endNT
186@endlocal & set ERROR_CODE=%ERROR_CODE%
187
188:postExec
189
190if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
191if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
192:skipRcPost
193
194@REM pause the batch file if MAVEN_BATCH_PAUSE is set to 'on'
195if "%MAVEN_BATCH_PAUSE%" == "on" pause
196
197if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
198
199exit /B %ERROR_CODE%