-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmvnw.cmd
More file actions
29 lines (24 loc) · 1.05 KB
/
mvnw.cmd
File metadata and controls
29 lines (24 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
@echo off
setlocal
set "WRAPPER_DIR=%~dp0.mvn\wrapper"
set "MAVEN_VERSION=3.9.9"
set "MAVEN_HOME=%WRAPPER_DIR%\apache-maven-%MAVEN_VERSION%"
set "MAVEN_EXE=%MAVEN_HOME%\bin\mvn.cmd"
set "DIST_URL=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/%MAVEN_VERSION%/apache-maven-%MAVEN_VERSION%-bin.zip"
set "DIST_ZIP=%WRAPPER_DIR%\apache-maven-%MAVEN_VERSION%-bin.zip"
if not exist "%MAVEN_EXE%" (
echo Maven %MAVEN_VERSION% not found locally. Downloading...
if not exist "%WRAPPER_DIR%" mkdir "%WRAPPER_DIR%"
powershell -NoProfile -ExecutionPolicy Bypass -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri '%DIST_URL%' -OutFile '%DIST_ZIP%'"
if errorlevel 1 (
echo Failed to download Maven distribution.
exit /b 1
)
powershell -NoProfile -ExecutionPolicy Bypass -Command "Expand-Archive -Path '%DIST_ZIP%' -DestinationPath '%WRAPPER_DIR%' -Force"
if errorlevel 1 (
echo Failed to extract Maven distribution.
exit /b 1
)
)
call "%MAVEN_EXE%" %*
exit /b %errorlevel%