-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Description
Describe the bug
When compiling the project on Windows running the command ./gradlew install you should face an error like:
* What went wrong:
A problem occurred evaluating settings 'spring-gradle-build-conventions-sample'.
> Unexpected internal error near index 1
\
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating settings 'spring-gradle-build-conventions-sample'.
This is happening on the file buildSrc/src/test/resources/samples/showcase/settings.gradle in the following code block String projectPath = buildFilePath.replace(rootDirPath, '').replaceAll(File.separator, ':')
The File.separator property in a Windows machine is the backslash \. And in the String#replaceAll method it states that
Note that backslashes (\) and dollar signs ($) in the replacement string may cause the results to be different than if it were being treated as a literal replacement string;
So we need to wrap the File.separator with Matcher#quoteReplacement in order to return a literal replacement String
To Reproduce
On a Windows machine, clone the spring-security repository and run the command ./gradlew install
Expected behavior
The project should be compiled with success