JavaDetector: a comment related to IDEA-253051

GitOrigin-RevId: fc3cc8109fb2a81863575313e347633b4a1ff743
This commit is contained in:
Leonid Bushuev
2020-10-30 14:25:46 +00:00
committed by intellij-monorepo-bot
parent 89e3accbb9
commit de9b33b3f3
@@ -238,7 +238,11 @@ public class JavaHomeFinderBasic {
var home = innerDir;
var releaseFile = home.resolve("release");
if (!exists(releaseFile)) continue;
if (mac && Files.isSymbolicLink(releaseFile) && home.getFileName().toString().contains("zulu")) {
// Zulu JDK on MacOS has a rogue layout, with which Gradle failed to operate (see the bugreport IDEA-253051),
// and in order to get Gradle working with Zulu JDK we should use it's second home (when symbolic links are resolved),
boolean zuluOnMac = mac && Files.isSymbolicLink(releaseFile) && home.getFileName().toString().contains("zulu");
if (zuluOnMac) {
try {
var realReleaseFile = releaseFile.toRealPath();
if (!exists(realReleaseFile)) { log.warn("Failed to resolve the target file (it doesn't exist) for: " + releaseFile.toString()); continue; }
@@ -250,6 +254,7 @@ public class JavaHomeFinderBasic {
log.warn("Failed to resolve the target file (exception) for: " + releaseFile.toString() + ": " + ioe.getMessage());
}
}
result.add(home.toString());
}
}