diff --git a/README.md b/README.md
index ce49b179..8fe36ddd 100644
--- a/README.md
+++ b/README.md
@@ -6,6 +6,10 @@ This is the [exec-maven-plugin](http://www.mojohaus.org/exec-maven-plugin/).
[![Maven Central](https://img.shields.io/maven-central/v/org.codehaus.mojo/exec-maven-plugin.svg?label=Maven%20Central)](https://search.maven.org/artifact/org.codehaus.mojo/exec-maven-plugin)
[![GitHub CI](https://github.com/mojohaus/exec-maven-plugin/actions/workflows/maven.yml/badge.svg)](https://github.com/mojohaus/exec-maven-plugin/actions/workflows/maven.yml)
+## Running integration tests
+
+Execute `mvn -P run-its clean verify`
+
## Releasing
* Make sure `gpg-agent` is running.
diff --git a/src/it/projects/mexec-439/invoker.properties b/src/it/projects/mexec-439/invoker.properties
new file mode 100644
index 00000000..d5a1730b
--- /dev/null
+++ b/src/it/projects/mexec-439/invoker.properties
@@ -0,0 +1 @@
+invoker.goals = clean test
diff --git a/src/it/projects/mexec-439/pom.xml b/src/it/projects/mexec-439/pom.xml
new file mode 100644
index 00000000..6c128873
--- /dev/null
+++ b/src/it/projects/mexec-439/pom.xml
@@ -0,0 +1,55 @@
+
+
+ 4.0.0
+
+
+ org.codehaus.mojo.exec.it
+ parent
+ 0.1
+
+
+ mexec-439
+ 0.0.1-SNAPSHOT
+ pom
+
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ @project.version@
+
+
+ test
+
+ exec
+
+
+ true
+
+ junit
+ junit
+
+ java
+
+ -classpath
+
+ org.junit.runner.JUnitCore
+
+
+
+
+
+
+ junit
+ junit
+ 4.13.2
+
+
+
+
+
+
+
diff --git a/src/main/java/org/codehaus/mojo/exec/ExecMojo.java b/src/main/java/org/codehaus/mojo/exec/ExecMojo.java
index 723c3fb8..8d2f9bb5 100644
--- a/src/main/java/org/codehaus/mojo/exec/ExecMojo.java
+++ b/src/main/java/org/codehaus/mojo/exec/ExecMojo.java
@@ -284,12 +284,6 @@ public class ExecMojo extends AbstractExecMojo {
@Parameter
private File environmentScript = null;
- /**
- * The current build session instance. This is used for toolchain manager API calls.
- */
- @Parameter(defaultValue = "${session}", readonly = true)
- private MavenSession session;
-
/**
* Exit codes to be resolved as successful execution for non-compliant applications (applications not returning 0
* for success).
@@ -430,8 +424,9 @@ public void execute() throws MojoExecutionException {
// output as a log prefix, to enable easy tracing of program output when intermixed with other
// Maven log output. NOTE: The accept(..) methods are running in PumpStreamHandler thread,
// which is why we capture the thread name prefix here.
- final String logPrefix =
- session.isParallel() ? "[" + Thread.currentThread().getName() + "] " : "";
+ final String logPrefix = getSession().isParallel()
+ ? "[" + Thread.currentThread().getName() + "] "
+ : "";
Consumer mavenOutRedirect = logMessage -> {
if (quietLogs) {
getLog().debug(logPrefix + logMessage);
@@ -942,6 +937,7 @@ public int[] getSuccessCodes() {
private Toolchain getToolchain() {
// session and toolchainManager can be null in tests ...
+ MavenSession session = getSession();
if (session != null && toolchainManager != null) {
return toolchainManager.getToolchainFromBuildContext(toolchain, session);
}