2019-11-08 16:40:12 +00:00
name : 'Setup Java JDK'
2019-12-06 14:35:32 -05:00
description : 'Set up a specific version of the Java JDK and add the
command-line tools to the PATH'
2019-07-10 10:54:25 -04:00
author : 'GitHub'
2019-12-06 14:36:32 -05:00
inputs :
2019-08-13 16:24:39 -04:00
java-version :
2026-07-09 20:11:03 -04:00
description : 'The Java version to set up. Takes a whole or semver Java version, or the "latest" alias to use the newest available stable release. See examples of supported syntax in README file'
2026-06-22 20:47:16 +05:30
required : false
2022-12-13 12:45:14 +01:00
java-version-file :
2026-06-22 20:47:16 +05:30
description : 'The path to a file containing the Java version to set up (.java-version, .tool-versions, .sdkmanrc). Used when java-version is not set. See examples of supported syntax in README file'
required : false
2021-04-05 13:02:27 +03:00
distribution :
2026-07-07 20:49:12 +02:00
description : 'Java distribution. See the list of supported distributions in README file. This input is required except when java-version-file points to .sdkmanrc with a recognized distribution suffix (e.g., java=21.0.5-tem).'
required : false
2019-11-22 15:32:49 -05:00
java-package :
2026-07-29 00:50:01 -04:00
description : 'The package type (`jdk`, `jre`, `jdk+fx`, `jre+fx`, `jdk+crac`, `jre+crac`, `jdk+jmods`, `jdk+jcef`, `jre+jcef`, `jdk+ft`, or `jre+ft`). Supported values vary by distribution.'
2019-11-22 10:45:27 -08:00
required : false
2019-11-02 21:39:35 -07:00
default : 'jdk'
2019-11-22 15:32:49 -05:00
architecture :
2026-07-29 15:46:29 -04:00
description : "The architecture of the package (`x86`, `x64`, `armv7`, `aarch64`, `ppc64le`, `ppc64`, or `s390x`). Aliases `ia32`, `amd64`, `arm`, and `arm64` are normalized to `x86`, `x64`, `armv7`, and `aarch64`. Supported values vary by distribution and operating system. Defaults to the action runner's architecture."
2019-11-22 10:45:27 -08:00
required : false
2026-07-08 12:44:58 -04:00
jdk-file :
2021-04-05 13:02:27 +03:00
description : 'Path to where the compressed JDK is located'
required : false
2026-07-08 12:44:58 -04:00
jdkFile :
description : 'Deprecated alias for `jdk-file`. Path to where the compressed JDK is located. Use `jdk-file` instead; this alias may be removed in a future release.'
required : false
deprecationMessage : 'The `jdkFile` input is deprecated. Use `jdk-file` instead.'
2021-04-05 13:02:27 +03:00
check-latest :
description : 'Set this option if you want the action to check for the latest available version that satisfies the version spec'
2019-07-15 11:26:32 -04:00
required : false
2021-04-05 13:02:27 +03:00
default : false
2026-07-28 14:43:47 -04:00
force-download :
description : 'Set this option to always download Java and replace any matching version in the tool cache'
required : false
default : false
2026-07-07 18:38:57 +02:00
set-default :
description : 'Set this option to false if you want to install a JDK but not make it the default. When false, JAVA_HOME and PATH are not updated, but JAVA_HOME_<major>_<arch> is still set.'
required : false
default : true
2026-06-29 13:19:49 +01:00
verify-signature :
description : 'Verify downloaded Java package signatures when supported by the selected distribution'
required : false
default : false
verify-signature-public-key :
description : 'ASCII-armored GPG public key used to verify the downloaded package signature. Overrides the default bundled key for the selected distribution.'
required : false
2019-11-28 14:18:30 -08:00
server-id :
2019-12-06 14:35:32 -05:00
description : 'ID of the distributionManagement repository in the pom.xml
2019-12-20 08:35:06 -08:00
file. Default is `github`'
2019-11-28 14:18:30 -08:00
required : false
2020-07-15 19:53:39 -06:00
default : 'github'
2026-07-17 20:10:58 -04:00
server-username-env-var :
2019-12-19 11:28:11 -08:00
description : 'Environment variable name for the username for authentication
2019-12-20 08:35:06 -08:00
to the Apache Maven repository. Default is $GITHUB_ACTOR'
2019-11-28 14:18:30 -08:00
required : false
2026-07-17 20:10:58 -04:00
server-username :
description : 'Deprecated alias for server-username-env-var'
required : false
server-password-env-var :
2019-12-19 11:28:11 -08:00
description : 'Environment variable name for password or token for
2019-12-20 08:35:06 -08:00
authentication to the Apache Maven repository. Default is $GITHUB_TOKEN'
2019-11-28 14:18:30 -08:00
required : false
2026-07-17 20:10:58 -04:00
server-password :
description : 'Deprecated alias for server-password-env-var'
required : false
2019-12-10 13:02:21 -08:00
settings-path :
2019-12-18 11:05:01 -08:00
description : 'Path to where the settings.xml file will be written. Default is ~/.m2.'
2019-12-10 13:02:21 -08:00
required : false
2021-04-05 13:02:27 +03:00
overwrite-settings :
description : 'Overwrite the settings.xml file if it exists. Default is "true".'
required : false
default : true
2020-05-02 04:33:15 -07:00
gpg-private-key :
description : 'GPG private key to import. Default is empty string.'
required : false
2026-06-22 20:47:16 +05:30
default : ''
2026-07-17 20:10:58 -04:00
gpg-passphrase-env-var :
description : 'Environment variable name for the GPG private key passphrase. Defaults to GPG_PASSPHRASE when gpg-private-key is set.'
required : false
2020-05-02 04:33:15 -07:00
gpg-passphrase :
2026-07-17 20:10:58 -04:00
description : 'Deprecated alias for gpg-passphrase-env-var'
2020-05-02 04:33:15 -07:00
required : false
2021-08-20 01:19:35 +08:00
cache :
2022-06-16 21:47:05 +01:00
description : 'Name of the build platform to cache dependencies. It can be "maven", "gradle" or "sbt".'
2021-08-20 01:19:35 +08:00
required : false
Add conditional JDK caching (#1201)
* Add JDK caching
Cache resolved JDK tool-cache entries by exact platform and release identity, with a default-on cache-jdk input and explicit opt-out.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Apply batched suggestions from code review
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Fix JDK cache CI validation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Update brace-expansion security fix
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Refresh brace-expansion license metadata
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Refine JDK cache semantics
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Refine JDK cache documentation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Simplify JDK cache identity
Use one normalized runner OS dimension, reset the internal cache key schema for the unreleased feature, and align documentation, tests, and bundles.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Align JDK cache OS identity
Use the established RUNNER_OS value directly and retain process.platform only as a non-Actions fallback.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Harden JDK cache saves and document tool-cache reuse
Bind each JDK cache key to the installation identity it was computed for,
keep post-job saves best-effort per entry, and state the real reuse and
verification guarantee in the documentation.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* docs: restructure README caching section
Rename '## Caching dependencies' to '## Caching' and add a what-gets-cached
overview table covering the dependency, wrapper, and JDK caches. Lead with the
common 'cache: maven' example and the dependency-cache material, and demote JDK
caching into its own subsection.
Also corrects the IMPORTANT callout, which implied JDK caching required an
explicit opt-in; it is enabled implicitly whenever 'cache' is set.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* docs: fix caching documentation defects
- Remove pull-request framing that compared behavior to `main`; state the
tool-cache and `jdkfile` behavior directly and unconditionally.
- Clarify that the JDK cache is a separate cache *entry* from the dependency
and wrapper caches, while its *enablement* is coupled to `cache`, so the
opening paragraph agrees with the enablement matrix.
- Cite the actions/setup-java-benchmarks repository instead of an open PR and
a self-referential PR comment, keeping the measured figures and caveats.
- Keep the `cache`/`cache-jdk` matrix only in docs/advanced-usage.md and
summarize the rules in prose in README.md to avoid divergence.
- Describe the guarantee that a cache key is only saved with the installation
it was computed for, instead of documenting inode/size/timestamp internals.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* docs: add V6 what's new entry for JDK caching
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e2755464-4e83-47b6-ba71-731bb481b418
---------
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot-Session: e2755464-4e83-47b6-ba71-731bb481b418
2026-08-04 21:54:10 -04:00
cache-jdk :
description : 'Cache downloaded JDK installations between jobs. Defaults to enabled when dependency caching is configured with `cache`; set explicitly to "true" or "false" to override.'
required : false
2023-11-23 00:43:14 +09:00
cache-dependency-path :
description: 'The path to a dependency file : pom.xml, build.gradle, build.sbt, etc. This option can be used with the `cache` option. If this option is omitted, the action searches for the dependency file in the entire repository. This option supports wildcards and a list of file names for caching multiple dependencies.'
required : false
2026-07-29 14:43:55 -04:00
cache-path :
description : 'The path to cache instead of the default dependency cache path for the selected package manager. This option can be used with the `cache` option and supports a list of paths and exclusion patterns.'
required : false
2026-07-29 10:20:14 -04:00
cache-read-only :
Add conditional JDK caching (#1201)
* Add JDK caching
Cache resolved JDK tool-cache entries by exact platform and release identity, with a default-on cache-jdk input and explicit opt-out.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Apply batched suggestions from code review
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Fix JDK cache CI validation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Update brace-expansion security fix
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Refresh brace-expansion license metadata
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Refine JDK cache semantics
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Refine JDK cache documentation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Simplify JDK cache identity
Use one normalized runner OS dimension, reset the internal cache key schema for the unreleased feature, and align documentation, tests, and bundles.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Align JDK cache OS identity
Use the established RUNNER_OS value directly and retain process.platform only as a non-Actions fallback.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Harden JDK cache saves and document tool-cache reuse
Bind each JDK cache key to the installation identity it was computed for,
keep post-job saves best-effort per entry, and state the real reuse and
verification guarantee in the documentation.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* docs: restructure README caching section
Rename '## Caching dependencies' to '## Caching' and add a what-gets-cached
overview table covering the dependency, wrapper, and JDK caches. Lead with the
common 'cache: maven' example and the dependency-cache material, and demote JDK
caching into its own subsection.
Also corrects the IMPORTANT callout, which implied JDK caching required an
explicit opt-in; it is enabled implicitly whenever 'cache' is set.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* docs: fix caching documentation defects
- Remove pull-request framing that compared behavior to `main`; state the
tool-cache and `jdkfile` behavior directly and unconditionally.
- Clarify that the JDK cache is a separate cache *entry* from the dependency
and wrapper caches, while its *enablement* is coupled to `cache`, so the
opening paragraph agrees with the enablement matrix.
- Cite the actions/setup-java-benchmarks repository instead of an open PR and
a self-referential PR comment, keeping the measured figures and caveats.
- Keep the `cache`/`cache-jdk` matrix only in docs/advanced-usage.md and
summarize the rules in prose in README.md to avoid divergence.
- Describe the guarantee that a cache key is only saved with the installation
it was computed for, instead of documenting inode/size/timestamp internals.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* docs: add V6 what's new entry for JDK caching
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e2755464-4e83-47b6-ba71-731bb481b418
---------
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot-Session: e2755464-4e83-47b6-ba71-731bb481b418
2026-08-04 21:54:10 -04:00
description : 'Restore caches without saving cache changes in the post action.'
2026-07-29 10:20:14 -04:00
required : false
default : false
2021-08-20 01:19:35 +08:00
job-status :
description : 'Workaround to pass job status to post job step. This variable is not intended for manual setting'
2026-06-22 20:47:16 +05:30
required : false
2021-08-20 01:19:35 +08:00
default : ${{ job.status }}
2022-09-23 14:47:30 +02:00
token :
2022-11-18 09:33:59 +01:00
description : The token used to authenticate when fetching version manifests hosted on github.com, such as for the Microsoft Build of OpenJDK. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting.
2026-06-22 20:47:16 +05:30
required : false
2022-11-18 09:33:59 +01:00
default : ${{ github.server_url == 'https://github.com' && github.token || '' }}
2022-01-16 17:33:29 +01:00
mvn-toolchain-id :
2026-08-04 23:29:25 -04:00
description : 'Name of Maven Toolchain ID if the default name of "${mvn-toolchain-vendor}_${java-version}" is not wanted. The toolchain vendor defaults to the "distribution" input. When supplied, the number of IDs must match the number of Java versions. See examples of supported syntax in Advanced Usage file'
2022-01-16 17:33:29 +01:00
required : false
mvn-toolchain-vendor :
description : 'Name of Maven Toolchain Vendor if the default name of "${distribution}" is not wanted. See examples of supported syntax in Advanced Usage file'
required : false
2026-07-02 17:12:50 -04:00
show-download-progress :
description : 'Whether Maven should print artifact download/transfer progress to the build log. When "false" (default) the action sets "-ntp" (--no-transfer-progress) in MAVEN_ARGS to produce cleaner logs. Set to "true" to keep the progress output. Has no effect on non-Maven builds.'
required : false
default : false
2026-07-16 11:28:10 -04:00
problem-matcher :
description : 'Whether to register the Java problem matcher (compiler errors/warnings and uncaught exceptions). Set to "false" to disable annotations.'
required : false
default : true
2020-05-24 20:03:57 +02:00
outputs :
2021-04-05 13:02:27 +03:00
distribution :
description : 'Distribution of Java that has been installed'
2020-05-24 20:03:57 +02:00
version :
description : 'Actual version of the java environment that has been installed'
2021-04-05 13:02:27 +03:00
path :
description : 'Path to where the java environment has been installed (same as $JAVA_HOME)'
2022-09-07 19:34:51 +09:00
cache-hit :
description : 'A boolean value to indicate an exact match was found for the primary key'
2026-07-09 11:19:31 -04:00
cache-primary-key :
description : 'The primary cache key computed by the action for the configured build tool. Empty when caching is not enabled or when caching is skipped (e.g. cache service unavailable). Useful for composing with actions/cache or actions/cache/restore across jobs.'
2019-07-10 10:54:25 -04:00
runs :
2025-08-20 20:07:47 +01:00
using : 'node24'
2020-05-02 04:33:15 -07:00
main : 'dist/setup/index.js'
post : 'dist/cleanup/index.js'