Skip to content

Commit 881bb9c

Browse files
wheezilJohn Lilley
and
John Lilley
authored
Do not get UPPERCASE env vars (#427)
* Do not get UPPERCASE env vars * PR feedback: use System.getenv() * Copy immutable env map * remove unused import --------- Co-authored-by: John Lilley <[email protected]>
1 parent b2ba5ae commit 881bb9c

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/main/java/org/codehaus/mojo/exec/ExecMojo.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import java.util.Iterator;
3737
import java.util.List;
3838
import java.util.Map;
39-
import java.util.Properties;
4039
import java.util.Set;
4140
import java.util.TreeSet;
4241
import java.util.function.Consumer;
@@ -476,13 +475,11 @@ public void execute() throws MojoExecutionException {
476475
}
477476

478477
private Map<String, String> handleSystemEnvVariables() throws MojoExecutionException {
479-
480-
Map<String, String> enviro = new HashMap<>();
481-
Properties systemEnvVars = CommandLineUtils.getSystemEnvVars();
482-
for (Map.Entry<?, ?> entry : systemEnvVars.entrySet()) {
483-
enviro.put((String) entry.getKey(), (String) entry.getValue());
484-
}
485-
478+
// Avoid creating env vars that differ only in case on Windows.
479+
// https://github.com/mojohaus/exec-maven-plugin/issues/328
480+
// It is not enough to avoid duplicates; we must preserve the case found in the "natural" environment.
481+
// https://developercommunity.visualstudio.com/t/Build-Error:-MSB6001-in-Maven-Build/10527486?sort=newest
482+
Map<String, String> enviro = new HashMap<>(System.getenv());
486483
if (environmentVariables != null) {
487484
enviro.putAll(environmentVariables);
488485
}

0 commit comments

Comments
 (0)