You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2022/12/18 16:18:37 UTC
[maven] branch maven-3.9.x 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.
michaelo pushed a commit to branch maven-3.9.x
in repository https://gitbox.apache.org/repos/asf/maven.git
The following commit(s) were added to refs/heads/maven-3.9.x by this push:
new a6b8a9e9f [MNG-7578] Fallback on Linux executable in Windows for findTool utility (#861)
a6b8a9e9f is described below
commit a6b8a9e9fb3ca1f742883abd8cafe9eb6bf39691
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)
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 59c184260..7f87f3a03 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 installDir) {
File bin = new File(installDir, "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;
}