Skip to content

Commit 16cd225

Browse files
mmazurslawekjaranowski
mmazur
authored andcommitted
Add toolchain java path to environment variables in ExecMojo
1 parent e54e602 commit 16cd225

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public class ExecMojo extends AbstractExecMojo {
8787
* Trying to recognize whether the given {@link #executable} might be a {@code java} binary.
8888
*/
8989
private static final Pattern ENDS_WITH_JAVA = Pattern.compile("^.*java(\\.exe|\\.bin)?$", Pattern.CASE_INSENSITIVE);
90+
private static final String TOOLCHAIN_JAVA_ENV_NAME = "TOOLCHAIN_JAVA";
9091

9192
/**
9293
* <p>
@@ -488,6 +489,11 @@ private Map<String, String> handleSystemEnvVariables() throws MojoExecutionExcep
488489
}
489490
}
490491

492+
Toolchain tc = getToolchain();
493+
if (tc != null) {
494+
enviro.put(TOOLCHAIN_JAVA_ENV_NAME, tc.findTool("java"));
495+
}
496+
491497
if (this.getLog().isDebugEnabled()) {
492498
Set<String> keys = new TreeSet<>(enviro.keySet());
493499
for (String key : keys) {

0 commit comments

Comments
 (0)