mthmulders commented on code in PR #14:
URL: 
https://github.com/apache/maven-toolchains-plugin/pull/14#discussion_r1513343272


##########
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:
   I'll double-check again one of these days, but I'm pretty sure that 
`<userHome>\scoop\apps` is not enough. Scoop-installed Java runtimes reside 
under `<userHome>\scoop\apps\<packageName>\<version>`, with 
`<userHome>\scoop\apps\<packageName>\current` as a symlink to the currently 
active version of that package.
   
   Regardless of that, the question remains: given that `openjdk21` has three 
installed versions (21.0.0, 21.0.1 and 21.0.2), do we want all of them to be 
detected or only the current one?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to