You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gn...@apache.org on 2022/12/09 09:07:57 UTC

[maven] branch master updated: [MNG-7578] Fallback on Linux executable in Windows for findTool utility (#861)

This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git


The following commit(s) were added to refs/heads/master by this push:
     new 55431cd26 [MNG-7578] Fallback on Linux executable in Windows for findTool utility (#861)
55431cd26 is described below

commit 55431cd267af1f4131f6fcb4c3b0d9c2c49641bf
Author: Simon <84...@users.noreply.github.com>
AuthorDate: Fri Dec 9 10:07:48 2022 +0100

    [MNG-7578] Fallback on Linux executable in Windows for findTool utility (#861)
    
    * [MVN-7578] Fallback on Linux executable in Windows for findTool utility
    * Fix code style
    Co-authored-by: Guillaume Nodet <gn...@gmail.com>
---
 .../java/org/apache/maven/toolchain/java/JavaToolchainImpl.java  | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolchainImpl.java b/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolchainImpl.java
index 543906d70..3ec434510 100644
--- a/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolchainImpl.java
+++ b/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolchainImpl.java
@@ -63,7 +63,14 @@ class JavaToolchainImpl extends DefaultToolchain implements JavaToolchain {
     private static File findTool(String toolName, File installFolder) {
         File bin = new File(installFolder, "bin"); // NOI18N
         if (bin.exists()) {
-            File tool = new File(bin, toolName + (Os.isFamily("windows") ? ".exe" : "")); // NOI18N
+            boolean isWindows = Os.isFamily("windows"); // NOI18N
+            if (isWindows) {
+                File tool = new File(bin, toolName + ".exe");
+                if (tool.exists()) {
+                    return tool;
+                }
+            }
+            File tool = new File(bin, toolName);
             if (tool.exists()) {
                 return tool;
             }