[ https://issues.apache.org/jira/browse/MTOOLCHAINS-49?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17823707#comment-17823707 ]
ASF GitHub Bot commented on MTOOLCHAINS-49: ------------------------------------------- gnodet commented on code in PR #14: URL: https://github.com/apache/maven-toolchains-plugin/pull/14#discussion_r1513173798 ########## src/main/java/org/apache/maven/plugins/toolchain/jdk/ToolchainDiscoverer.java: ########## @@ -411,10 +411,12 @@ private Set<Path> findJdks() { installedDirs.add(Paths.get(userHome, "Library/Java/JavaVirtualMachines")); } else if (win) { installedDirs.add(Paths.get("C:\\Program Files\\Java\\")); - Path scoop = Paths.get(userHome, "scoop/apps"); + Path scoop = Paths.get(userHome, "scoop", "apps"); if (Files.isDirectory(scoop)) { try (Stream<Path> stream = Files.list(scoop)) { - stream.forEach(dirsToTest::add); + // Scoop can install multiple versions of a Java distribution, we only take the one that is + // currently selected. + stream.map(path -> Paths.get(path.toString(), "current")).forEach(dirsToTest::add); Review Comment: The goal is to find all JDK installed, not only the `current` one. My undersanding is that they are installed by scoop in `C:\Users\M67B014\scoop\apps\[jdk-name]\[version]`. The `installedDirs` should then point to `C:\Users\M67B014\scoop\apps\[jdk-name]` because it's later scanned for JDK in its child directories, see https://github.com/apache/maven-toolchains-plugin/blob/0e858055930cdd3e6687c61e421978539a947dd3/src/main/java/org/apache/maven/plugins/toolchain/jdk/ToolchainDiscoverer.java#L432-L436 So by adding all direct children of `scoop\apps`, we should later have the children of those directories. Are you sure the fix in line 414 is not sufficient ? > Automatic discovery of JDK toolchains > ------------------------------------- > > Key: MTOOLCHAINS-49 > URL: https://issues.apache.org/jira/browse/MTOOLCHAINS-49 > Project: Maven Toolchains Plugin > Issue Type: Improvement > Reporter: Guillaume Nodet > Assignee: Guillaume Nodet > Priority: Major > -- This message was sent by Atlassian Jira (v8.20.10#820010)