Statistics
| Revision:

svn-gvsig-desktop / tags / v1_10_0_Build_1263_RC2 / build / maven / bin / mvnDebug.bat @ 43637

History | View | Annotate | Download (5.94 KB)

1 20506 jcampos
@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 -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
33
@REM ----------------------------------------------------------------------------
34
35
set INT_MAVEN_OPTS=%MAVEN_OPTS% -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
36
@echo Preparing to Execute Maven in Debug Mode
37
38
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
39
@echo off
40
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
41
@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%
42
43
@REM set %HOME% to equivalent of $HOME
44
if "%HOME%" == "" (set HOME=%HOMEDRIVE%%HOMEPATH%)
45
46
@REM Execute a user defined script before this one
47
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
48
49
set ERROR_CODE=0
50
51
@REM set local scope for the variables with windows NT shell
52
if "%OS%"=="Windows_NT" @setlocal
53
if "%OS%"=="WINNT" @setlocal
54
55
@REM ==== START VALIDATION ====
56
if not "%JAVA_HOME%" == "" goto OkJHome
57
58
echo.
59
echo ERROR: JAVA_HOME not found in your environment.
60
echo Please set the JAVA_HOME variable in your environment to match the
61
echo location of your Java installation
62
echo.
63
goto error
64
65
:OkJHome
66
if exist "%JAVA_HOME%\bin\java.exe" goto chkMHome
67
68
echo.
69
echo ERROR: JAVA_HOME is set to an invalid directory.
70
echo JAVA_HOME = %JAVA_HOME%
71
echo Please set the JAVA_HOME variable in your environment to match the
72
echo location of your Java installation
73
echo.
74
goto error
75
76
:chkMHome
77
if not "%M2_HOME%"=="" goto valMHome
78
79
if "%OS%"=="Windows_NT" SET M2_HOME=%~dp0..
80
if "%OS%"=="WINNT" SET M2_HOME=%~dp0..
81
if not "%M2_HOME%"=="" goto valMHome
82
83
echo.
84
echo ERROR: M2_HOME not found in your environment.
85
echo Please set the M2_HOME variable in your environment to match the
86
echo location of the Maven installation
87
echo.
88
goto error
89
90
:valMHome
91
92
:stripMHome
93
if not _%M2_HOME:~-1%==_\ goto checkMBat
94
set M2_HOME=%M2_HOME:~0,-1%
95
goto stripMHome
96
97
:checkMBat
98
if exist "%M2_HOME%\bin\mvn.bat" goto init
99
100
echo.
101
echo ERROR: M2_HOME is set to an invalid directory.
102
echo M2_HOME = %M2_HOME%
103
echo Please set the M2_HOME variable in your environment to match the
104
echo location of the Maven installation
105
echo.
106
goto error
107
@REM ==== END VALIDATION ====
108
109
:init
110
@REM Decide how to startup depending on the version of windows
111
112
@REM -- Windows NT with Novell Login
113
if "%OS%"=="WINNT" goto WinNTNovell
114
115
@REM -- Win98ME
116
if NOT "%OS%"=="Windows_NT" goto Win9xArg
117
118
:WinNTNovell
119
120
@REM -- 4NT shell
121
if "%@eval[2+2]" == "4" goto 4NTArgs
122
123
@REM -- Regular WinNT shell
124
set MAVEN_CMD_LINE_ARGS=%*
125
goto endInit
126
127
@REM The 4NT Shell from jp software
128
:4NTArgs
129
set MAVEN_CMD_LINE_ARGS=%$
130
goto endInit
131
132
:Win9xArg
133
@REM Slurp the command line arguments.  This loop allows for an unlimited number
134
@REM of agruments (up to the command line limit, anyway).
135
set MAVEN_CMD_LINE_ARGS=
136
:Win9xApp
137
if %1a==a goto endInit
138
set MAVEN_CMD_LINE_ARGS=%MAVEN_CMD_LINE_ARGS% %1
139
shift
140
goto Win9xApp
141
142
@REM Reaching here means variables are defined and arguments have been captured
143
:endInit
144
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
145
146
@REM -- 4NT shell
147
if "%@eval[2+2]" == "4" goto 4NTCWJars
148
149
@REM -- Regular WinNT shell
150
for %%i in ("%M2_HOME%"\boot\classworlds-*) do set CLASSWORLDS_JAR="%%i"
151
goto runm2
152
153
@REM The 4NT Shell from jp software
154
:4NTCWJars
155
for %%i in ("%M2_HOME%\boot\classworlds-*") do set CLASSWORLDS_JAR="%%i"
156
goto runm2
157
158
@REM Start MAVEN2
159
:runm2
160
161
%MAVEN_JAVA_EXE% %INT_MAVEN_OPTS% -classpath %CLASSWORLDS_JAR% "-Dclassworlds.conf=%M2_HOME%\bin\m2.conf" "-Dmaven.home=%M2_HOME%" org.codehaus.classworlds.Launcher %MAVEN_CMD_LINE_ARGS%
162
if ERRORLEVEL 1 goto error
163
goto end
164
165
:error
166
if "%OS%"=="Windows_NT" @endlocal
167
if "%OS%"=="WINNT" @endlocal
168
set ERROR_CODE=1
169
170
:end
171
@REM set local scope for the variables with windows NT shell
172
if "%OS%"=="Windows_NT" goto endNT
173
if "%OS%"=="WINNT" goto endNT
174
175
@REM For old DOS remove the set variables from ENV - we assume they were not set
176
@REM before we started - at least we don't leave any baggage around
177
set MAVEN_JAVA_EXE=
178
set MAVEN_CMD_LINE_ARGS=
179
goto postExec
180
181
:endNT
182
@endlocal & set ERROR_CODE=%ERROR_CODE%
183
184
:postExec
185
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
186
@REM pause the batch file if MAVEN_BATCH_PAUSE is set to 'on'
187
if "%MAVEN_BATCH_PAUSE%" == "on" pause
188
189
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
190
191
exit /B %ERROR_CODE%