From 462bd1121b7a7ee9a61ff1ed6a1dbd8fcf2982e0 Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Fri, 21 Apr 2023 20:17:08 +0200 Subject: [PATCH] [MSHARED-1014] Make Commandline.addSystemEnvironment public and deprecated MavenInvoker still use it. --- .../org/apache/maven/shared/utils/cli/Commandline.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/maven/shared/utils/cli/Commandline.java b/src/main/java/org/apache/maven/shared/utils/cli/Commandline.java index 4f93957f..619f5a10 100644 --- a/src/main/java/org/apache/maven/shared/utils/cli/Commandline.java +++ b/src/main/java/org/apache/maven/shared/utils/cli/Commandline.java @@ -183,8 +183,13 @@ public void addEnvironment(String name, String value) { /** * Add system environment variables. + * + * @deprecated please use {@link #setShellEnvironmentInherited(boolean)} */ - private void addSystemEnvironment() { + @Deprecated + public void addSystemEnvironment() {} + + private void copySystemEnvironment() { Properties systemEnvVars = CommandLineUtils.getSystemEnvVars(); for (Object o : systemEnvVars.keySet()) { @@ -202,7 +207,7 @@ private void addSystemEnvironment() { */ public String[] getEnvironmentVariables() { if (isShellEnvironmentInherited()) { - addSystemEnvironment(); + copySystemEnvironment(); } List environmentVars = new ArrayList<>();