[ 
https://issues.apache.org/jira/browse/MTOOLCHAINS-49?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17823746#comment-17823746
 ] 

ASF GitHub Bot commented on MTOOLCHAINS-49:
-------------------------------------------

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?





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

Reply via email to