Context
I have a project in Java 8 that uses some libraries that don't exist on newer versions. I want to make a release using the Maven Release Plugin, with the command mvn release:prepare
. I'm running this command inside IntelliJ, from the Execute Maven Goal
button in Maven view.
Problem
When running mvn release:prepare
, Maven correctly uses the Java 8 defined for my project. However, at some point, the goal tries to run another goal (mvn clean verify
), which ends up using the system's default Java, which is Java 11. This last goal tries to compile the project but, since it is running with Java 11, it fails due to missing libraries.
Attempts
I've tried using the goal's javaHome
parameter to specify the Java Home, like this:
mvn release:prepare -DjavaHome=C:\Users\X\.jdks\corretto-1.8.0_312
But nothing seems to change.
Question
In Maven Release Plugin's release:prepare
goal, is there a way to specify the Java Home to be used in nested Maven invocations?