Skip to content

Commit

Permalink
[MWRAPPER-113] mvnw.cmd PowerShell error and surrounding empty lines …
Browse files Browse the repository at this point in the history
…go to standard output

Use Write-Error instead of Write-Output in the PowerShell part.
Also redirect the empty lines that surround error messages to stderr.
  • Loading branch information
inkarkat committed Feb 5, 2024
1 parent 316261e commit d4f9b3a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions maven-wrapper-distribution/src/resources/mvnw.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,22 @@ set ERROR_CODE=0
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome

echo.
echo. >&2
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
echo. >&2
goto error

:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init

echo.
echo. >&2
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
echo. >&2
goto error

@REM ==== END VALIDATION ====
Expand Down Expand Up @@ -162,9 +162,9 @@ IF NOT %WRAPPER_SHA_256_SUM%=="" (
powershell -Command "&{"^
"$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^
"If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^
" Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^
" Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^
" Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^
" Write-Error 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^
" Write-Error 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^
" Write-Error 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^
" exit 1;"^
"}"^
"}"
Expand Down

0 comments on commit d4f9b3a

Please sign in to comment.