Closed
Description
When calling the action several times, it will overwrite the JAVA_HOME environment variable and prepend it to the PATH, effectively shadowing a previous run of the action.
Fortunately, it will also set a JAVA_HOME_<version>_<architecture> environment variable, but this could be more idiomatic as an output parameter (in addition to the environment variable, which can also be useful on its own: #44 (comment))
This would be a great addition to #21
That way, one could write something like:
- name: Setup JDK 11
id: setup-java-11
uses: actions/setup-java@v1
with:
java-version: 11
# here with #21, one would disable "installation"
- name: Setup JDK 14
id: setup-java-14
uses: actions/setup-java@v1
with:
java-version: 14
# here with #21, one would disable "installation"
- name: Setup JDK 8
# Ran last due each run shadowing the previous ones; see also #21
uses: actions/setup-java@v1
with:
java-version: 8
- name: Build and run tests (with JDK 8)
run: ./gradlew build
- name: Run tests with JDK 11
run: ./gradlew test -Ptest.jdk-path="${{ steps.setup-java-11.outputs.jdk-path }}"
- name: Run tests with JDK 14
run: ./gradlew test -Ptest.jdk-path="${{ steps.setup-java-14.outputs.jdk-path }}"(here, the build is still running with JDK 8, but it coud configure its tests to actually use another JDK)
Metadata
Metadata
Assignees
Labels
No labels
Activity
tbroyer commentedon May 24, 2020
This is actually worse than that:
java-version: 11won't actually setJAVA_HOME_11_x64, butJAVA_HOME_11.0.7_x64, making that variable essentially useless as its name will actually change whenever a new version of the JDK is released.As a workaround, I'm using (with a previous call with
java-version: 11and a previous Gradle build with JDK 11: the new build here still runs with JDK 11 so it won't recompile Java sources)I could have used a
::set-envtoo of course to setJAVA_HOME_11_x64.Add output parameters for the tool path and version
Add output parameters for the tool path and version
Add output parameters for the tool path and version
Add output parameters for the tool path and version
Add output parameters for the tool path and version
Ryan9Manu commentedon Oct 18, 2022
Nmnbbb
Ryan9Manu commentedon Oct 18, 2022
Bjjk
Ryan9Manu commentedon Oct 18, 2022
Bnnk no nn
Add output parameters for the tool path and version