blob: 13e709841d728f38d06a1036891bece444504b4c [file] [log] [blame]
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# NOTE: this action sets up the Java toolchain with optional Gradle caching.
# Gradle itself is provided via the wrapper (gradlew) in each project.
name: setup-java-with-cache
description: Setup Java toolchain with optional Gradle caching (uses gradlew wrapper)
inputs:
java-version:
description: "Java version to use"
required: false
default: "17"
java-distribution:
description: "Java distribution to use"
required: false
default: "temurin"
gradle-cache-disabled:
description: "Whether to disable Gradle caching"
required: false
default: "false"
runs:
using: "composite"
steps:
- name: Setup Java (with Gradle cache)
if: inputs.gradle-cache-disabled != 'true'
uses: actions/setup-java@v4
with:
distribution: ${{ inputs.java-distribution }}
java-version: ${{ inputs.java-version }}
cache: gradle
- name: Setup Java (no cache)
if: inputs.gradle-cache-disabled == 'true'
uses: actions/setup-java@v4
with:
distribution: ${{ inputs.java-distribution }}
java-version: ${{ inputs.java-version }}
- name: Verify Java installation
run: |
echo "Java setup complete (Gradle provided via wrapper)"
java --version
shell: bash