Skip to content

Commit 2f7af1b

Browse files
authored
make it clear that Java 21 is supported (#566)
Update examples and references to Java where older Java versions are used to highlight the support of Java 21. Specific provider examples are only updated where they support Java 21. Fixes #557
1 parent 16ef37f commit 2f7af1b

File tree

2 files changed

+24
-19
lines changed

2 files changed

+24
-19
lines changed

README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ steps:
7373
- uses: actions/setup-java@v4
7474
with:
7575
distribution: 'temurin' # See 'Supported distributions' for available options
76-
java-version: '17'
76+
java-version: '21'
7777
- run: java HelloWorldApp.java
7878
```
7979
@@ -84,13 +84,13 @@ steps:
8484
- uses: actions/setup-java@v4
8585
with:
8686
distribution: 'zulu' # See 'Supported distributions' for available options
87-
java-version: '17'
87+
java-version: '21'
8888
- run: java HelloWorldApp.java
8989
```
9090
9191
#### Supported version syntax
9292
The `java-version` input supports an exact version or a version range using [SemVer](https://semver.org/) notation:
93-
- major versions: `8`, `11`, `16`, `17`
93+
- major versions: `8`, `11`, `16`, `17`, `21`
9494
- more specific versions: `17.0`, `11.0`, `11.0.4`, `8.0.232`, `8.0.282+8`
9595
- early access (EA) versions: `15-ea`, `15.0.0-ea`, `15.0.0-ea.2`, `15.0.0+2-ea`
9696

@@ -135,7 +135,7 @@ steps:
135135
- uses: actions/setup-java@v4
136136
with:
137137
distribution: 'temurin'
138-
java-version: '17'
138+
java-version: '21'
139139
cache: 'gradle'
140140
cache-dependency-path: | # optional
141141
sub-project/*.gradle*
@@ -150,7 +150,7 @@ steps:
150150
- uses: actions/setup-java@v4
151151
with:
152152
distribution: 'temurin'
153-
java-version: '17'
153+
java-version: '21'
154154
cache: 'maven'
155155
cache-dependency-path: 'sub-project/pom.xml' # optional
156156
- name: Build with Maven
@@ -164,7 +164,7 @@ steps:
164164
- uses: actions/setup-java@v4
165165
with:
166166
distribution: 'temurin'
167-
java-version: '17'
167+
java-version: '21'
168168
cache: 'sbt'
169169
cache-dependency-path: | # optional
170170
sub-project/build.sbt
@@ -184,7 +184,7 @@ steps:
184184
- uses: actions/setup-java@v4
185185
with:
186186
distribution: 'temurin'
187-
java-version: '17'
187+
java-version: '21'
188188
cache: 'gradle'
189189
- run: ./gradlew build --no-daemon
190190
```
@@ -204,7 +204,7 @@ steps:
204204
- uses: actions/setup-java@v4
205205
with:
206206
distribution: 'temurin'
207-
java-version: '17'
207+
java-version: '21'
208208
check-latest: true
209209
- run: java HelloWorldApp.java
210210
```
@@ -216,7 +216,7 @@ jobs:
216216
runs-on: ubuntu-20.04
217217
strategy:
218218
matrix:
219-
java: [ '8', '11', '17' ]
219+
java: [ '8', '11', '17', '21' ]
220220
name: Java ${{ matrix.Java }} sample
221221
steps:
222222
- uses: actions/checkout@v4

docs/advanced-usage.md

+15-10
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@ See [action.yml](../action.yml) for more details on task inputs.
2525
Inputs `java-version` and `distribution` are mandatory and needs to be provided. See [Supported distributions](../README.md#Supported-distributions) for a list of available options.
2626

2727
### Eclipse Temurin
28+
2829
```yaml
2930
steps:
3031
- uses: actions/checkout@v4
3132
- uses: actions/setup-java@v4
3233
with:
3334
distribution: 'temurin'
34-
java-version: '11'
35+
java-version: '21'
3536
- run: java -cp java HelloWorldApp
3637
```
3738
@@ -49,37 +50,40 @@ steps:
4950
```
5051

5152
### Zulu
53+
5254
```yaml
5355
steps:
5456
- uses: actions/checkout@v4
5557
- uses: actions/setup-java@v4
5658
with:
5759
distribution: 'zulu'
58-
java-version: '11'
60+
java-version: '21'
5961
java-package: jdk # optional (jdk, jre, jdk+fx or jre+fx) - defaults to jdk
6062
- run: java -cp java HelloWorldApp
6163
```
6264

6365
### Liberica
66+
6467
```yaml
6568
steps:
6669
- uses: actions/checkout@v4
6770
- uses: actions/setup-java@v4
6871
with:
6972
distribution: 'liberica'
70-
java-version: '11'
73+
java-version: '21'
7174
java-package: jdk # optional (jdk, jre, jdk+fx or jre+fx) - defaults to jdk
7275
- run: java -cp java HelloWorldApp
7376
```
7477

7578
### Microsoft
79+
7680
```yaml
7781
steps:
7882
- uses: actions/checkout@v4
7983
- uses: actions/setup-java@v4
8084
with:
8185
distribution: 'microsoft'
82-
java-version: '11'
86+
java-version: '21'
8387
- run: java -cp java HelloWorldApp
8488
```
8589

@@ -94,7 +98,7 @@ uses: actions/setup-java@v4
9498
with:
9599
token: ${{ secrets.GH_DOTCOM_TOKEN }}
96100
distribution: 'microsoft'
97-
java-version: '11'
101+
java-version: '21'
98102
```
99103

100104
If the runner is not able to access github.com, any Java versions requested during a workflow run must come from the runner's tool cache. See "[Setting up the tool cache on self-hosted runners without internet access](https://docs.github.com/en/enterprise-server@3.2/admin/github-actions/managing-access-to-actions-from-githubcom/setting-up-the-tool-cache-on-self-hosted-runners-without-internet-access)" for more information.
@@ -108,7 +112,7 @@ steps:
108112
- uses: actions/setup-java@v4
109113
with:
110114
distribution: 'corretto'
111-
java-version: '11'
115+
java-version: '21'
112116
- run: java -cp java HelloWorldApp
113117
```
114118

@@ -121,12 +125,13 @@ steps:
121125
- uses: actions/setup-java@v4
122126
with:
123127
distribution: 'oracle'
124-
java-version: '17'
128+
java-version: '21'
125129
- run: java -cp java HelloWorldApp
126130
```
127131

128132
### Alibaba Dragonwell
129133
**NOTE:** Alibaba Dragonwell only provides jdk.
134+
130135
```yaml
131136
steps:
132137
- uses: actions/checkout@v4
@@ -188,7 +193,7 @@ If your use-case requires a custom distribution (in the example, alpine-linux is
188193
- name: fetch latest temurin JDK
189194
id: fetch_latest_jdk
190195
run: |
191-
major_version={{ env.JAVA_VERSION }} # Example 8 or 11 or 17
196+
major_version={{ env.JAVA_VERSION }} # Example 16 or 21 or 22
192197
cd $RUNNER_TEMP
193198
response=$(curl -s "https://api.github.com/repos/adoptium/temurin${major_version}-binaries/releases")
194199
latest_jdk_download_url=$(echo "$response" | jq -r '.[0].assets[] | select(.name | contains("jdk_x64_alpine-linux") and endswith(".tar.gz")) | .browser_download_url')
@@ -439,7 +444,7 @@ steps:
439444
- uses: actions/setup-java@v4
440445
with:
441446
distribution: '<distribution>'
442-
java-version: 15
447+
java-version: '15'
443448
```
444449

445450
The result is a Toolchain with entries for JDKs 8, 11 and 15. You can even combine this with custom JDKs of arbitrary versions:
@@ -523,7 +528,7 @@ If the `java-version-file` input is specified, the action will try to extract th
523528
Action is able to recognize all variants of the version description according to [jenv](https://github.com/jenv/jenv).
524529
Valid entry options:
525530
```
526-
major versions: 8, 11, 16, 17
531+
major versions: 8, 11, 16, 17, 21
527532
more specific versions: 1.8.0.2, 17.0, 11.0, 11.0.4, 8.0.232, 8.0.282+8
528533
early access (EA) versions: 15-ea, 15.0.0-ea, 15.0.0-ea.2, 15.0.0+2-ea
529534
versions with specified distribution: openjdk64-11.0.2

0 commit comments

Comments
 (0)