-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[MNG-8018] Fix MSYS/Git-Bash path mis-detection on Windows #10906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…hs early in MavenCli.initialize(), fixing nested repo location and settings lookup. Adds JUnit 5 Windows-only test for path normalisation.
FYI, on master the What exact issue you have and it may mean you need to check out maven-cli as well. |
done. |
…ent wrong local-repo location.
|
||
/** | ||
* Turns “/d/projects/foo” into “D:\\projects\\foo”. | ||
* Returns the original string if it isn't an MSYS-style path. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's MSYS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minimal System, is a software distribution and build platform for Windows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MSYS2?
Might need to spell this out. Is MSYS really the style of string here, or is this just a Windows path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
POSIX-style Windows paths produced by MSYS2/Git Bash (and Cygwin), e.g. /c/Users/... or /cygdrive/c/.... The method converts those to native C:... and returns the input if it’s already a native Windows path.
* Turns “/d/projects/foo” into “D:\\projects\\foo”. | ||
* Returns the original string if it isn't an MSYS-style path. | ||
*/ | ||
static String msysToWindowsPath(final String p) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
p --> path
if (p == null) { | ||
return null; | ||
} | ||
final Matcher m = MSYS_PATH.matcher(p); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m --> matcher
if (org.codehaus.plexus.util.Os.isFamily("windows")) { | ||
System.setProperty("user.home", msysToWindowsPath(System.getProperty("user.home"))); | ||
|
||
for (final String k : new String[] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
k?
"alternateSettings", | ||
"user.toolchains" | ||
}) { | ||
final String v = System.getProperty(k); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid single letter variable names
Adds JUnit 5 Windows-only test for path normalisation.
Following this checklist to help us incorporate your
contribution quickly and easily:
Note that commits might be squashed by a maintainer on merge.
This may not always be possible but is a best-practice.
mvn verify
to make sure basic checks pass.A more thorough check will be performed on your pull request automatically.
If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.