When compiling code and running tests in github actions, java version has to be specified and changed when a new version arrives. Instead of having to change java version each time manually we can configure our actions to read java version from our maven config.
- name: Get required JDK version from Maven project run: | JDK_VERSION=$(mvn help:evaluate -Dexpression=maven.compiler.release -q -DforceStdout) echo "JDK_VERSION=$JDK_VERSION" >> $GITHUB_ENV - name: Set up JDK uses: actions/setup-java@v2 with: java-version: ${{ env.JDK_VERSION }} distribution: microsoft
https://github.com/brunoborges/aks-jvm-benchmark/blob/main/.github/workflows/maven.yml
When compiling code and running tests in github actions, java version has to be specified and changed when a new version arrives. Instead of having to change java version each time manually we can configure our actions to read java version from our maven config.
- name: Get required JDK version from Maven project run: | JDK_VERSION=$(mvn help:evaluate -Dexpression=maven.compiler.release -q -DforceStdout) echo "JDK_VERSION=$JDK_VERSION" >> $GITHUB_ENV - name: Set up JDK uses: actions/setup-java@v2 with: java-version: ${{ env.JDK_VERSION }} distribution: microsofthttps://github.com/brunoborges/aks-jvm-benchmark/blob/main/.github/workflows/maven.yml