Description:
When multiple Java versions are configured and the number of mvn-toolchain-id entries differs from the number of java-version entries, the action silently discards every supplied custom ID and generates defaults. This hides workflow configuration mistakes and can select an unexpected Maven toolchain.
Validate the relationship before installing any JDK. If mvn-toolchain-id is supplied, require exactly one ID per configured Java version and report both counts in the error. Add unit tests for matching, missing, and extra IDs, including single-version and java-version-file usage.
Task version:
v6
Platform:
Runner type:
Repro steps:
Configure two Java versions but only one custom toolchain ID:
- uses: actions/setup-java@v6
with:
distribution: temurin
java-version: |
17
21
mvn-toolchain-id: custom-jdk
Expected behavior:
The action fails before installation with a descriptive message that two Java versions require two Maven toolchain IDs.
Actual behavior:
The supplied ID is silently discarded and both toolchains receive generated default IDs.
Description:
When multiple Java versions are configured and the number of
mvn-toolchain-identries differs from the number ofjava-versionentries, the action silently discards every supplied custom ID and generates defaults. This hides workflow configuration mistakes and can select an unexpected Maven toolchain.Validate the relationship before installing any JDK. If
mvn-toolchain-idis supplied, require exactly one ID per configured Java version and report both counts in the error. Add unit tests for matching, missing, and extra IDs, including single-version andjava-version-fileusage.Task version:
v6
Platform:
Runner type:
Repro steps:
Configure two Java versions but only one custom toolchain ID:
Expected behavior:
The action fails before installation with a descriptive message that two Java versions require two Maven toolchain IDs.
Actual behavior:
The supplied ID is silently discarded and both toolchains receive generated default IDs.