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

slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-jdeprscan-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new ee4ffeb  Use PATH fallback when JAVA_HOME is not set
ee4ffeb is described below

commit ee4ffeb014efffa3111f4a9586a6c55dd6b67be1
Author: Siva Sai Udayagiri <[email protected]>
AuthorDate: Wed Apr 22 20:48:05 2026 -0400

    Use PATH fallback when JAVA_HOME is not set
---
 .../org/apache/maven/plugins/jdeprscan/AbstractJDeprScanMojo.java | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/src/main/java/org/apache/maven/plugins/jdeprscan/AbstractJDeprScanMojo.java 
b/src/main/java/org/apache/maven/plugins/jdeprscan/AbstractJDeprScanMojo.java
index 9d85dca..4e5520a 100644
--- 
a/src/main/java/org/apache/maven/plugins/jdeprscan/AbstractJDeprScanMojo.java
+++ 
b/src/main/java/org/apache/maven/plugins/jdeprscan/AbstractJDeprScanMojo.java
@@ -107,6 +107,7 @@ public abstract class AbstractJDeprScanMojo extends 
AbstractMojo {
     }
 
     private String getJDeprScanExecutable() throws IOException {
+
         Toolchain tc = getToolchain();
 
         String jdeprscanExecutable = null;
@@ -115,7 +116,6 @@ public abstract class AbstractJDeprScanMojo extends 
AbstractMojo {
         }
 
         String jdepsCommand = "jdeprscan" + (SystemUtils.IS_OS_WINDOWS ? 
".exe" : "");
-
         File jdeprscanExe;
 
         if (StringUtils.isNotEmpty(jdeprscanExecutable)) {
@@ -143,11 +143,14 @@ public abstract class AbstractJDeprScanMojo extends 
AbstractMojo {
         // Try to find jdepsExe from JAVA_HOME environment variable
         // 
----------------------------------------------------------------------
         if (!jdeprscanExe.exists() || !jdeprscanExe.isFile()) {
+
             Properties env = CommandLineUtils.getSystemEnvVars();
             String javaHome = env.getProperty("JAVA_HOME");
+
             if (StringUtils.isEmpty(javaHome)) {
-                throw new IOException("The environment variable JAVA_HOME is 
not correctly set.");
+                return jdepsCommand;
             }
+
             if ((!new File(javaHome).getCanonicalFile().exists())
                     || (new File(javaHome).getCanonicalFile().isFile())) {
                 throw new IOException("The environment variable JAVA_HOME=" + 
javaHome
@@ -162,7 +165,6 @@ public abstract class AbstractJDeprScanMojo extends 
AbstractMojo {
             throw new IOException("The jdeps executable '" + jdeprscanExe
                     + "' doesn't exist or is not a file. Verify the JAVA_HOME 
environment variable.");
         }
-
         return jdeprscanExe.getAbsolutePath();
     }
 

Reply via email to