Debian Codegraph @

pmaven-cli/src/main/underlay/bin/translate.bat

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