docs: update setup-java examples (#1131)
* docs: update setup-java examples * docs: fix YAML example indentation Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 190c65c4-f5aa-4595-8e2e-26266fbcb37f * docs: note v6 development status Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 190c65c4-f5aa-4595-8e2e-26266fbcb37f --------- Co-authored-by: Bruno Borges <brborges@microsoft.com>
This commit is contained in:
@@ -20,6 +20,9 @@ This action allows you to work with Java and Scala projects.
|
|||||||
|
|
||||||
## What's new in V6
|
## What's new in V6
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> V6 is still in development (`main` branch) and is not yet recommended for production workflows.
|
||||||
|
|
||||||
- **Migrated to ESM** to enable support for the latest `@actions/*` package versions. This is an internal implementation change only. No changes are required to your workflow configuration, and the action's behavior is unchanged. Existing workflows continue to work as before.
|
- **Migrated to ESM** to enable support for the latest `@actions/*` package versions. This is an internal implementation change only. No changes are required to your workflow configuration, and the action's behavior is unchanged. Existing workflows continue to work as before.
|
||||||
|
|
||||||
## Breaking changes in V6
|
## Breaking changes in V6
|
||||||
@@ -72,15 +75,15 @@ For more details, see the full release notes on the [releases page](https://git
|
|||||||
|
|
||||||
- `server-id`: ID of the distributionManagement repository in the pom.xml file. Default is `github`.
|
- `server-id`: ID of the distributionManagement repository in the pom.xml file. Default is `github`.
|
||||||
|
|
||||||
- `server-username`: Environment variable name for the username for authentication to the Apache Maven repository. Default is GITHUB_ACTOR.
|
- `server-username`: Environment variable name for the username for authentication to the Apache Maven repository. Default is GITHUB\_ACTOR.
|
||||||
|
|
||||||
- `server-password`: Environment variable name for password or token for authentication to the Apache Maven repository. Default is GITHUB_TOKEN.
|
- `server-password`: Environment variable name for password or token for authentication to the Apache Maven repository. Default is GITHUB\_TOKEN.
|
||||||
|
|
||||||
- `settings-path`: Maven related setting to point to the directory where the settings.xml file will be written. Default is ~/.m2.
|
- `settings-path`: Maven related setting to point to the directory where the settings.xml file will be written. Default is \~/.m2.
|
||||||
|
|
||||||
- `gpg-private-key`: GPG private key to import. Default is empty string.
|
- `gpg-private-key`: GPG private key to import. Default is empty string.
|
||||||
|
|
||||||
- `gpg-passphrase`: Environment variable name for the GPG private key passphrase. Default is GPG_PASSPHRASE.
|
- `gpg-passphrase`: Environment variable name for the GPG private key passphrase. Default is GPG\_PASSPHRASE.
|
||||||
|
|
||||||
- `mvn-toolchain-id`: Name of Maven Toolchain ID if the default name of `${distribution}_${java-version}` is not wanted.
|
- `mvn-toolchain-id`: Name of Maven Toolchain ID if the default name of `${distribution}_${java-version}` is not wanted.
|
||||||
|
|
||||||
@@ -93,8 +96,8 @@ For more details, see the full release notes on the [releases page](https://git
|
|||||||
#### Eclipse Temurin
|
#### Eclipse Temurin
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin' # See 'Supported distributions' for available options
|
distribution: 'temurin' # See 'Supported distributions' for available options
|
||||||
java-version: '25'
|
java-version: '25'
|
||||||
@@ -104,8 +107,8 @@ steps:
|
|||||||
#### Azul Zulu OpenJDK
|
#### Azul Zulu OpenJDK
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'zulu' # See 'Supported distributions' for available options
|
distribution: 'zulu' # See 'Supported distributions' for available options
|
||||||
java-version: '25'
|
java-version: '25'
|
||||||
@@ -180,8 +183,8 @@ The cache input is optional, and caching is turned off by default.
|
|||||||
#### Caching gradle dependencies
|
#### Caching gradle dependencies
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '25'
|
java-version: '25'
|
||||||
@@ -202,8 +205,8 @@ For setup details and a comprehensive overview of all available features, visit
|
|||||||
#### Caching maven dependencies
|
#### Caching maven dependencies
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '25'
|
java-version: '25'
|
||||||
@@ -223,8 +226,8 @@ steps:
|
|||||||
#### Caching sbt dependencies
|
#### Caching sbt dependencies
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '25'
|
java-version: '25'
|
||||||
@@ -243,8 +246,8 @@ Usually, cache gets downloaded in multiple segments of fixed sizes. Sometimes, a
|
|||||||
env:
|
env:
|
||||||
SEGMENT_DOWNLOAD_TIMEOUT_MINS: '5'
|
SEGMENT_DOWNLOAD_TIMEOUT_MINS: '5'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '25'
|
java-version: '25'
|
||||||
@@ -263,8 +266,8 @@ For Java distributions that are not cached on Hosted images, `check-latest` alwa
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '25'
|
java-version: '25'
|
||||||
@@ -282,9 +285,9 @@ jobs:
|
|||||||
java: [ '8', '11', '17', '21', '25' ]
|
java: [ '8', '11', '17', '21', '25' ]
|
||||||
name: Java ${{ matrix.Java }} sample
|
name: Java ${{ matrix.Java }} sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- name: Setup java
|
- name: Setup java
|
||||||
uses: actions/setup-java@v5
|
uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: '<distribution>'
|
distribution: '<distribution>'
|
||||||
java-version: ${{ matrix.java }}
|
java-version: ${{ matrix.java }}
|
||||||
@@ -293,11 +296,11 @@ jobs:
|
|||||||
|
|
||||||
### Install multiple JDKs
|
### Install multiple JDKs
|
||||||
|
|
||||||
All configured Java versions are added to the PATH. The last one added to the PATH (i.e., the last JDK set up by this action) will be used as the default and available globally. Other Java versions can be accessed through environment variables such as 'JAVA_HOME_{{ MAJOR_VERSION }}_{{ ARCHITECTURE }}'. To use a specific Java version, set the JAVA_HOME environment variable accordingly and prepend its bin directory to the PATH to ensure it takes priority during execution.
|
All configured Java versions are added to the PATH. The last one added to the PATH (i.e., the last JDK set up by this action) will be used as the default and available globally. Other Java versions can be accessed through environment variables such as 'JAVA\_HOME\_{{ MAJOR\_VERSION }}\_{{ ARCHITECTURE }}'. To use a specific Java version, set the JAVA\_HOME environment variable accordingly and prepend its bin directory to the PATH to ensure it takes priority during execution.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: '<distribution>'
|
distribution: '<distribution>'
|
||||||
java-version: |
|
java-version: |
|
||||||
@@ -337,15 +340,6 @@ In the example above multiple JDKs are installed for the same job. The result af
|
|||||||
- [Modifying Maven Toolchains](docs/advanced-usage.md#Modifying-Maven-Toolchains)
|
- [Modifying Maven Toolchains](docs/advanced-usage.md#Modifying-Maven-Toolchains)
|
||||||
- [Java Version File](docs/advanced-usage.md#Java-version-file)
|
- [Java Version File](docs/advanced-usage.md#Java-version-file)
|
||||||
|
|
||||||
## V2 vs V1
|
|
||||||
|
|
||||||
Examples in this README use `actions/setup-java@v5`, but the main migration note from V1 still applies to all later major versions (`v2`, `v3`, `v4`, and `v5`):
|
|
||||||
|
|
||||||
- Starting with V2, the action supports custom distributions. V1 supports only Azul Zulu OpenJDK.
|
|
||||||
- Starting with V2, you must specify distribution along with the version. V1 defaults to Azul Zulu OpenJDK, so only version input is required. Follow [the migration guide](docs/switching-to-v2.md) to switch from V1 to V2.
|
|
||||||
|
|
||||||
For information about the latest releases, recent updates, and newly supported distributions, please refer to the `setup-java` [Releases](https://github.com/actions/setup-java/releases).
|
|
||||||
|
|
||||||
## Recommended permissions
|
## Recommended permissions
|
||||||
|
|
||||||
When using the `setup-java` action in your GitHub Actions workflow, it is recommended to set the following permissions to ensure proper functionality:
|
When using the `setup-java` action in your GitHub Actions workflow, it is recommended to set the following permissions to ensure proper functionality:
|
||||||
|
|||||||
+78
-78
@@ -39,8 +39,8 @@ Inputs `java-version` and `distribution` are mandatory and needs to be provided.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '25'
|
java-version: '25'
|
||||||
@@ -52,8 +52,8 @@ steps:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'adopt-hotspot'
|
distribution: 'adopt-hotspot'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
@@ -64,8 +64,8 @@ steps:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'zulu'
|
distribution: 'zulu'
|
||||||
java-version: '25'
|
java-version: '25'
|
||||||
@@ -77,8 +77,8 @@ steps:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'liberica'
|
distribution: 'liberica'
|
||||||
java-version: '25'
|
java-version: '25'
|
||||||
@@ -91,8 +91,8 @@ Liberica Native Image Kit (NIK) is a GraalVM-based distribution. `java-version`
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'liberica-nik'
|
distribution: 'liberica-nik'
|
||||||
java-version: '25'
|
java-version: '25'
|
||||||
@@ -104,8 +104,8 @@ steps:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'microsoft'
|
distribution: 'microsoft'
|
||||||
java-version: '25'
|
java-version: '25'
|
||||||
@@ -119,7 +119,7 @@ steps:
|
|||||||
To get a higher rate limit, you can [generate a personal access token on github.com](https://github.com/settings/tokens/new) and pass it as the `token` input for the action:
|
To get a higher rate limit, you can [generate a personal access token on github.com](https://github.com/settings/tokens/new) and pass it as the `token` input for the action:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: actions/setup-java@v5
|
uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GH_DOTCOM_TOKEN }}
|
token: ${{ secrets.GH_DOTCOM_TOKEN }}
|
||||||
distribution: 'microsoft'
|
distribution: 'microsoft'
|
||||||
@@ -133,8 +133,8 @@ If the runner is not able to access github.com, any Java versions requested duri
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'corretto'
|
distribution: 'corretto'
|
||||||
java-version: '25'
|
java-version: '25'
|
||||||
@@ -146,8 +146,8 @@ steps:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'oracle'
|
distribution: 'oracle'
|
||||||
java-version: '25'
|
java-version: '25'
|
||||||
@@ -159,8 +159,8 @@ steps:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'dragonwell'
|
distribution: 'dragonwell'
|
||||||
java-version: '8'
|
java-version: '8'
|
||||||
@@ -171,8 +171,8 @@ steps:
|
|||||||
**NOTE:** An OpenJDK release maintained and supported by SAP
|
**NOTE:** An OpenJDK release maintained and supported by SAP
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'sapmachine'
|
distribution: 'sapmachine'
|
||||||
java-version: '25'
|
java-version: '25'
|
||||||
@@ -184,8 +184,8 @@ steps:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'graalvm'
|
distribution: 'graalvm'
|
||||||
java-version: '25'
|
java-version: '25'
|
||||||
@@ -199,8 +199,8 @@ steps:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'graalvm-community'
|
distribution: 'graalvm-community'
|
||||||
java-version: '21'
|
java-version: '21'
|
||||||
@@ -218,8 +218,8 @@ For example, `11.0.24` is not available but `11.0.16` is.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'jetbrains'
|
distribution: 'jetbrains'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
@@ -231,8 +231,8 @@ GitHub token to the action to increase the rate limit. Set the `GITHUB_TOKEN` en
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'jetbrains'
|
distribution: 'jetbrains'
|
||||||
java-version: '17'
|
java-version: '17'
|
||||||
@@ -257,8 +257,8 @@ The available package types are:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'kona'
|
distribution: 'kona'
|
||||||
java-version: '21'
|
java-version: '21'
|
||||||
@@ -268,8 +268,8 @@ steps:
|
|||||||
## Installing custom Java package type
|
## Installing custom Java package type
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: '<distribution>'
|
distribution: '<distribution>'
|
||||||
java-version: '25'
|
java-version: '25'
|
||||||
@@ -283,8 +283,8 @@ For JavaFX projects that use Maven, use `jdk+fx` (or `jre+fx`) as the `java-pack
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'zulu'
|
distribution: 'zulu'
|
||||||
java-version: '25'
|
java-version: '25'
|
||||||
@@ -348,8 +348,8 @@ the full set):
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '25'
|
java-version: '25'
|
||||||
@@ -371,8 +371,8 @@ jobs:
|
|||||||
seed-cache:
|
seed-cache:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '25'
|
java-version: '25'
|
||||||
@@ -387,8 +387,8 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
goal: ['test', 'verify', 'test -Pprofile1']
|
goal: ['test', 'verify', 'test -Pprofile1']
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '25'
|
java-version: '25'
|
||||||
@@ -428,8 +428,8 @@ jobs:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: '<distribution>'
|
distribution: '<distribution>'
|
||||||
java-version: '25'
|
java-version: '25'
|
||||||
@@ -443,12 +443,12 @@ When installing multiple JDKs, the last one installed becomes the default (`JAVA
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '17'
|
java-version: '17'
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
id: setup-java-21
|
id: setup-java-21
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
@@ -476,7 +476,7 @@ steps:
|
|||||||
- run: |
|
- run: |
|
||||||
download_url="https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.10%2B9/OpenJDK11U-jdk_x64_linux_hotspot_11.0.10_9.tar.gz"
|
download_url="https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.10%2B9/OpenJDK11U-jdk_x64_linux_hotspot_11.0.10_9.tar.gz"
|
||||||
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
|
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'jdkfile'
|
distribution: 'jdkfile'
|
||||||
jdk-file: ${{ runner.temp }}/java_package.tar.gz
|
jdk-file: ${{ runner.temp }}/java_package.tar.gz
|
||||||
@@ -493,7 +493,7 @@ steps:
|
|||||||
- run: |
|
- run: |
|
||||||
download_url="https://download.java.net/java/early_access/jdk25/36/GPL/openjdk-25-ea+36_linux-x64_bin.tar.gz"
|
download_url="https://download.java.net/java/early_access/jdk25/36/GPL/openjdk-25-ea+36_linux-x64_bin.tar.gz"
|
||||||
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
|
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'jdkfile'
|
distribution: 'jdkfile'
|
||||||
jdk-file: ${{ runner.temp }}/java_package.tar.gz
|
jdk-file: ${{ runner.temp }}/java_package.tar.gz
|
||||||
@@ -519,7 +519,7 @@ If your use-case requires a custom distribution (in the example, alpine-linux is
|
|||||||
latest_semver_version=$(curl -sL $latest_jdk_json_url | jq -r 'version.semver')
|
latest_semver_version=$(curl -sL $latest_jdk_json_url | jq -r 'version.semver')
|
||||||
echo "java_version=$latest_semver_version" >> "$GITHUB_OUTPUT"
|
echo "java_version=$latest_semver_version" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'jdkfile'
|
distribution: 'jdkfile'
|
||||||
jdk-file: ${{ runner.temp }}/java_package.tar.gz
|
jdk-file: ${{ runner.temp }}/java_package.tar.gz
|
||||||
@@ -540,9 +540,9 @@ jobs:
|
|||||||
java: [ '8', '11' ]
|
java: [ '8', '11' ]
|
||||||
name: Java ${{ matrix.Java }} (${{ matrix.distribution }}) sample
|
name: Java ${{ matrix.Java }} (${{ matrix.distribution }}) sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- name: Setup java
|
- name: Setup java
|
||||||
uses: actions/setup-java@v5
|
uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: ${{ matrix.distribution }}
|
distribution: ${{ matrix.distribution }}
|
||||||
java-version: ${{ matrix.java }}
|
java-version: ${{ matrix.java }}
|
||||||
@@ -560,9 +560,9 @@ jobs:
|
|||||||
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
|
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
|
||||||
name: Java ${{ matrix.Java }} (${{ matrix.os }}) sample
|
name: Java ${{ matrix.Java }} (${{ matrix.os }}) sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- name: Setup java
|
- name: Setup java
|
||||||
uses: actions/setup-java@v5
|
uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: ${{ matrix.java }}
|
java-version: ${{ matrix.java }}
|
||||||
@@ -577,9 +577,9 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- name: Set up JDK 11
|
- name: Set up JDK 11
|
||||||
uses: actions/setup-java@v5
|
uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: '<distribution>'
|
distribution: '<distribution>'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
@@ -593,7 +593,7 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password
|
GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password
|
||||||
|
|
||||||
- name: Set up Apache Maven Central
|
- name: Set up Apache Maven Central
|
||||||
uses: actions/setup-java@v5
|
uses: actions/setup-java@v6
|
||||||
with: # running setup-java again overwrites the settings.xml
|
with: # running setup-java again overwrites the settings.xml
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
@@ -666,7 +666,7 @@ setup-java imports the key independently of the plugin version, but the generate
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Set up Apache Maven Central
|
- name: Set up Apache Maven Central
|
||||||
uses: actions/setup-java@v5
|
uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
@@ -733,9 +733,9 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- name: Set up JDK 11 for Shared Runner
|
- name: Set up JDK 11 for Shared Runner
|
||||||
uses: actions/setup-java@v5
|
uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: '<distribution>'
|
distribution: '<distribution>'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
@@ -765,8 +765,8 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: '<distribution>'
|
distribution: '<distribution>'
|
||||||
java-version: '21'
|
java-version: '21'
|
||||||
@@ -801,8 +801,8 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: '<distribution>'
|
distribution: '<distribution>'
|
||||||
java-version: '21'
|
java-version: '21'
|
||||||
@@ -822,10 +822,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
- name: Set up JDK 11
|
- name: Set up JDK 11
|
||||||
uses: actions/setup-java@v5
|
uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: '<distribution>'
|
distribution: '<distribution>'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
@@ -861,14 +861,14 @@ Toolchain entries are always merged non-destructively: existing JDK, custom, and
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: '<distribution>'
|
distribution: '<distribution>'
|
||||||
java-version: |
|
java-version: |
|
||||||
8
|
8
|
||||||
11
|
11
|
||||||
|
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: '<distribution>'
|
distribution: '<distribution>'
|
||||||
java-version: '15'
|
java-version: '15'
|
||||||
@@ -880,7 +880,7 @@ The result is a Toolchain with entries for JDKs 8, 11 and 15. You can even combi
|
|||||||
- run: |
|
- run: |
|
||||||
download_url="https://example.com/java/jdk/6u45-b06/jdk-6u45-linux-x64.tar.gz"
|
download_url="https://example.com/java/jdk/6u45-b06/jdk-6u45-linux-x64.tar.gz"
|
||||||
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
|
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'jdkfile'
|
distribution: 'jdkfile'
|
||||||
jdk-file: ${{ runner.temp }}/java_package.tar.gz
|
jdk-file: ${{ runner.temp }}/java_package.tar.gz
|
||||||
@@ -897,7 +897,7 @@ Each JDK provider will receive a default `vendor` using the `distribution` input
|
|||||||
- run: |
|
- run: |
|
||||||
download_url="https://example.com/java/jdk/6u45-b06/jdk-6u45-linux-x64.tar.gz"
|
download_url="https://example.com/java/jdk/6u45-b06/jdk-6u45-linux-x64.tar.gz"
|
||||||
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
|
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'jdkfile'
|
distribution: 'jdkfile'
|
||||||
jdk-file: ${{ runner.temp }}/java_package.tar.gz
|
jdk-file: ${{ runner.temp }}/java_package.tar.gz
|
||||||
@@ -912,7 +912,7 @@ In case you install multiple versions of Java at once with multi-line `java-vers
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: '<distribution>'
|
distribution: '<distribution>'
|
||||||
java-version: |
|
java-version: |
|
||||||
@@ -926,8 +926,8 @@ Each JDK provider will receive a default `id` based on the combination of `distr
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
@@ -939,7 +939,7 @@ In case you install multiple versions of Java at once you can use the same synta
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: '<distribution>'
|
distribution: '<distribution>'
|
||||||
java-version: |
|
java-version: |
|
||||||
@@ -1001,7 +1001,7 @@ steps:
|
|||||||
**Example step using `Sdkman!`** (distribution inferred from `.sdkmanrc`):
|
**Example step using `Sdkman!`** (distribution inferred from `.sdkmanrc`):
|
||||||
```yml
|
```yml
|
||||||
- name: Setup java
|
- name: Setup java
|
||||||
uses: actions/setup-java@v5
|
uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
java-version-file: '.sdkmanrc'
|
java-version-file: '.sdkmanrc'
|
||||||
```
|
```
|
||||||
@@ -1014,7 +1014,7 @@ java=17.0.7-tem
|
|||||||
**Example step using `asdf`** (distribution inferred from `.tool-versions`):
|
**Example step using `asdf`** (distribution inferred from `.tool-versions`):
|
||||||
```yml
|
```yml
|
||||||
- name: Setup java
|
- name: Setup java
|
||||||
uses: actions/setup-java@v5
|
uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
java-version-file: '.tool-versions'
|
java-version-file: '.tool-versions'
|
||||||
```
|
```
|
||||||
@@ -1058,7 +1058,7 @@ steps:
|
|||||||
- name: Trust the internal CA
|
- name: Trust the internal CA
|
||||||
run: echo "NODE_EXTRA_CA_CERTS=/etc/ssl/certs/internal-ca.pem" >> "$GITHUB_ENV"
|
run: echo "NODE_EXTRA_CA_CERTS=/etc/ssl/certs/internal-ca.pem" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '21'
|
java-version: '21'
|
||||||
@@ -1073,7 +1073,7 @@ steps:
|
|||||||
echo "${{ secrets.INTERNAL_CA_PEM }}" > "${RUNNER_TEMP}/internal-ca.pem"
|
echo "${{ secrets.INTERNAL_CA_PEM }}" > "${RUNNER_TEMP}/internal-ca.pem"
|
||||||
echo "NODE_EXTRA_CA_CERTS=${RUNNER_TEMP}/internal-ca.pem" >> "$GITHUB_ENV"
|
echo "NODE_EXTRA_CA_CERTS=${RUNNER_TEMP}/internal-ca.pem" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '21'
|
java-version: '21'
|
||||||
@@ -1101,7 +1101,7 @@ The JDK keeps its own trust store — a keystore named `cacerts` under `$JAVA_HO
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '21'
|
java-version: '21'
|
||||||
|
|||||||
Reference in New Issue
Block a user