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 ?



-- 
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