(I am aware that this project is frozen. However, this version of maven wrapper is still very common, including in new projects generated by Spring Initializr. Therefore, I request this be kept open as documentation for others on how to resolve this issue.)
The mvnw.cmd script that has a bug in the functionality that should loop over the .mvn/wrapper/maven-wrapper.properties, which causes the properties to not take effect. This is especially problematic in development environments that require the use of a maven repository other than Maven Central.
To fix the issue, in mvnw.cmd edit the FOR loop at lines 125-127 to add the usebackq option
FOR /F "tokens=1,2 delims== usebackq" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
Explanation: The double quotes around the filename causes the FOR command to treat it as string. But adding the usebackq option changes the FOR command to instead treat the double-quoted string as a filename set (reference)
(I am aware that this project is frozen. However, this version of maven wrapper is still very common, including in new projects generated by Spring Initializr. Therefore, I request this be kept open as documentation for others on how to resolve this issue.)
The
mvnw.cmd
script that has a bug in the functionality that should loop over the.mvn/wrapper/maven-wrapper.properties
, which causes the properties to not take effect. This is especially problematic in development environments that require the use of a maven repository other than Maven Central.To fix the issue, in mvnw.cmd edit the FOR loop at lines 125-127 to add the
usebackq
optionExplanation: The double quotes around the filename causes the FOR command to treat it as string. But adding the
usebackq
option changes the FOR command to instead treat the double-quoted string as a filename set (reference)