Closed
Description
I need to run Maven under JDK 17, while building source code under JDK 11.
The documentation explains how to set up the toolchain, but doesn't seem to indicate how to specify the JDK under which Maven itself has to run.
Could you please clarify the proper way to specify the JDK (in my case, 17) for running Maven, as I select multiple JDKs for toolchain? Do I have to explicitly set JAVA_HOME
after selecting the JDKs? What else?
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: |
11
17
# How do I make `mvn` run under JDK 17?
# Is there a declarative statement to add?
# Do I have to explicitly set `JAVA_HOME`?
# What else?
- name: Build with Maven
run: mvn -B package --file pom.xml