mirror of https://github.com/apache/maven.git
[MNG-7796] Be lenient when using toRealPath (#1130)
This commit is contained in:
parent
34685bbc2d
commit
ba3d3516eb
|
@ -348,12 +348,7 @@ public class MavenCli {
|
||||||
isAltFile = arg.equals(String.valueOf(CLIManager.ALTERNATE_POM_FILE)) || arg.equals("file");
|
isAltFile = arg.equals(String.valueOf(CLIManager.ALTERNATE_POM_FILE)) || arg.equals("file");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
topDirectory = getCanonicalPath(topDirectory);
|
||||||
topDirectory = topDirectory.toAbsolutePath().toRealPath();
|
|
||||||
} catch (IOException e) {
|
|
||||||
System.err.println("Error computing real path from " + topDirectory);
|
|
||||||
throw new ExitException(1);
|
|
||||||
}
|
|
||||||
cliRequest.topDirectory = topDirectory;
|
cliRequest.topDirectory = topDirectory;
|
||||||
// We're very early in the process and we don't have the container set up yet,
|
// We're very early in the process and we don't have the container set up yet,
|
||||||
// so we rely on the JDK services to eventually lookup a custom RootLocator.
|
// so we rely on the JDK services to eventually lookup a custom RootLocator.
|
||||||
|
@ -1589,6 +1584,14 @@ public class MavenCli {
|
||||||
return interpolator;
|
return interpolator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Path getCanonicalPath(Path path) {
|
||||||
|
try {
|
||||||
|
return path.toRealPath();
|
||||||
|
} catch (IOException e) {
|
||||||
|
return getCanonicalPath(path.getParent()).resolve(path.getFileName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static class ExitException extends Exception {
|
static class ExitException extends Exception {
|
||||||
int exitCode;
|
int exitCode;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue