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-mvnd.git
The following commit(s) were added to refs/heads/master by this push: new 6cc1770 System properties should have precedence over environment variables, fixes #675 (#680) 6cc1770 is described below commit 6cc1770200ac0baa8784fb8b9b3ebd5068119e27 Author: Guillaume Nodet <gno...@gmail.com> AuthorDate: Wed Sep 7 11:01:01 2022 +0200 System properties should have precedence over environment variables, fixes #675 (#680) --- .../main/java/org/mvndaemon/mvnd/client/DaemonParameters.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/client/src/main/java/org/mvndaemon/mvnd/client/DaemonParameters.java b/client/src/main/java/org/mvndaemon/mvnd/client/DaemonParameters.java index 789934d..54ddb62 100644 --- a/client/src/main/java/org/mvndaemon/mvnd/client/DaemonParameters.java +++ b/client/src/main/java/org/mvndaemon/mvnd/client/DaemonParameters.java @@ -59,6 +59,7 @@ public class DaemonParameters { private static final Logger LOG = LoggerFactory.getLogger(DaemonParameters.class); private static final String EXT_CLASS_PATH = "maven.ext.class.path"; private static final String EXTENSIONS_FILENAME = ".mvn/extensions.xml"; + private static final String ENV_PREFIX = "env."; protected final Map<Path, Properties> mvndProperties = new ConcurrentHashMap<>(); protected final Function<Path, Properties> provider = path -> mvndProperties.computeIfAbsent(path, @@ -104,10 +105,10 @@ public class DaemonParameters { description -> description.append("path relative to the mvnd executable"), this::mvndHomeFromExecutable)) .orSystemProperty() - .orEnvironmentVariable() .orLocalProperty(provider, suppliedPropertiesPath()) .orLocalProperty(provider, localPropertiesPath()) .orLocalProperty(provider, userPropertiesPath()) + .orEnvironmentVariable() .orFail() .asPath() .toAbsolutePath().normalize(); @@ -130,12 +131,12 @@ public class DaemonParameters { public Path javaHome() { final Path result = value(Environment.JAVA_HOME) - .orEnvironmentVariable() .orLocalProperty(provider, suppliedPropertiesPath()) .orLocalProperty(provider, localPropertiesPath()) .orLocalProperty(provider, userPropertiesPath()) .orLocalProperty(provider, globalPropertiesPath()) .orSystemProperty() + .orEnvironmentVariable() .orFail() .asPath(); try { @@ -163,8 +164,8 @@ public class DaemonParameters { public Path suppliedPropertiesPath() { return value(Environment.MVND_PROPERTIES_PATH) - .orEnvironmentVariable() .orSystemProperty() + .orEnvironmentVariable() .asPath(); } @@ -191,9 +192,9 @@ public class DaemonParameters { public Path daemonStorage() { return value(Environment.MVND_DAEMON_STORAGE) - .orEnvironmentVariable() .orSystemProperty() .orLocalProperty(provider, globalPropertiesPath()) + .orEnvironmentVariable() .orDefault( () -> userHome().resolve(".m2/mvnd/registry/" + BuildProperties.getInstance().getVersion()).toString()) .asPath();