mirror of
https://github.com/apache/maven-mvnd.git
synced 2026-01-13 07:04:14 +08:00
* Add a test * Simplify the stream processing Co-authored-by: Guillaume Nodet <gnodet@gmail.com>
This commit is contained in:
@@ -139,7 +139,8 @@ public class DaemonParameters {
|
||||
.orLocalProperty(provider, globalPropertiesPath())
|
||||
.orSystemProperty()
|
||||
.orEnvironmentVariable()
|
||||
.or(new ValueSource(description -> description.append("java command"), this::javaHomeFromPath))
|
||||
.or(new ValueSource(
|
||||
description -> description.append("java command"), DaemonParameters::javaHomeFromPath))
|
||||
.orFail()
|
||||
.asPath();
|
||||
try {
|
||||
@@ -149,8 +150,12 @@ public class DaemonParameters {
|
||||
}
|
||||
}
|
||||
|
||||
private String javaHomeFromPath() {
|
||||
final String jHome = OsUtils.findJavaHomeFromPath();
|
||||
private static String javaHomeFromPath() {
|
||||
LOG.warn(
|
||||
"Falling back to finding JAVA_HOME by running java executable available in PATH."
|
||||
+ " You may want to avoid this time consumig task by setting JAVA_HOME environment variable"
|
||||
+ " or by passing java.home system property through command line or in one of mvnd configuration files.");
|
||||
final String jHome = OsUtils.findJavaHomeFromJavaExecutable("java");
|
||||
if (null != jHome) {
|
||||
System.setProperty(Environment.JAVA_HOME.getProperty(), jHome);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user