You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by en...@apache.org on 2020/10/21 03:06:58 UTC

[sling-feature-launcher-maven-plugin] branch master updated: SLING-9843 fallback to java.home system property if JAVA_HOME env variable is not set

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

enorman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-feature-launcher-maven-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 8e639d8  SLING-9843 fallback to java.home system property if JAVA_HOME env variable is not set
8e639d8 is described below

commit 8e639d8b29fe0956bf9e0d3d4599cef3b80893d4
Author: Eric Norman <en...@apache.org>
AuthorDate: Tue Oct 20 20:06:38 2020 -0700

    SLING-9843 fallback to java.home system property if JAVA_HOME env
    variable is not set
---
 .../java/org/apache/sling/maven/feature/launcher/StartMojo.java   | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/maven/feature/launcher/StartMojo.java b/src/main/java/org/apache/sling/maven/feature/launcher/StartMojo.java
index ff66ad5..b39c7ab 100644
--- a/src/main/java/org/apache/sling/maven/feature/launcher/StartMojo.java
+++ b/src/main/java/org/apache/sling/maven/feature/launcher/StartMojo.java
@@ -116,7 +116,13 @@ public class StartMojo extends AbstractMojo {
                 File featureFile = result.getArtifact().getFile();
                 
                 List<String> args = new ArrayList<>();
-                args.add(System.getenv("JAVA_HOME") + File.separatorChar + "bin" + File.separatorChar + "java");
+                String javahome = System.getenv("JAVA_HOME");
+                if (javahome == null || javahome.isEmpty()) {
+                	// SLING-9843 fallback to java.home system property if JAVA_HOME env variable is not set
+                	getLog().warn("The JAVA_HOME env variable was not set, falling back to the java.home system property");
+                	javahome = System.getProperty("java.home");
+                }
+				args.add(javahome + File.separatorChar + "bin" + File.separatorChar + "java");
                 args.add("-jar");
                 args.add(launcher.getAbsolutePath());
                 args.add("-f");