Skip to content

Commit

Permalink
Do not get UPPERCASE env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
John Lilley committed May 10, 2024
1 parent 8d3327f commit ec3679c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/java/org/codehaus/mojo/exec/ExecMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,13 @@ public void execute() throws MojoExecutionException {
private Map<String, String> handleSystemEnvVariables() throws MojoExecutionException {

Map<String, String> enviro = new HashMap<>();
Properties systemEnvVars = CommandLineUtils.getSystemEnvVars();

// Avoid creating env vars that differ only in case on Windows.
// https://github.com/mojohaus/exec-maven-plugin/issues/328
// It is not enough to avoid duplicates; we must preserve the case found in the "natural" environment.
// https://developercommunity.visualstudio.com/t/Build-Error:-MSB6001-in-Maven-Build/10527486?sort=newest
Properties systemEnvVars = CommandLineUtils.getSystemEnvVars(true);

for (Map.Entry<?, ?> entry : systemEnvVars.entrySet()) {
enviro.put((String) entry.getKey(), (String) entry.getValue());
}
Expand Down

0 comments on commit ec3679c

Please sign in to comment.