You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-2Lines changed: 21 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,7 +59,26 @@ Currently, the following distributions are supported:
59
59
60
60
**NOTE:** The different distributors can provide discrepant list of available versions / supported configurations. Please refer to the official documentation to see the list of supported versions.
61
61
62
-
#### Testing against different Java versions
62
+
### Check latest
63
+
In the basic examples above, the `check-latest` flag defaults to `false`. When set to `false`, the action tries to first resolve a version of Java from the local tool cache on the runner. If unable to find a specific version in the cache, the action will download a version of Java. Use the default or set `check-latest` to `false` if you prefer a faster more consistent setup experience that prioritizes trying to use the cached versions at the expense of newer versions sometimes being available for download.
64
+
65
+
If `check-latest` is set to `true`, the action first checks if the cached version is the latest one. If the locally cached version is not the most up-to-date, the latest version of Java will be downloaded. Set `check-latest` to `true` if you want the most up-to-date version of Java to always be used. Setting `check-latest` to `true` has performance implications as downloading versions of Java is slower than using cached versions.
66
+
67
+
For Java distributions that are not cached on Hosted images, `check-latest` always behaves as `true` and downloads Java on-flight. Check out [Hosted Tool Cache](docs/advanced-usage.md#Hosted-Tool-Cache) for more details about pre-cached Java versions.
68
+
69
+
70
+
```yaml
71
+
steps:
72
+
- uses: actions/checkout@v2
73
+
- uses: actions/setup-java@v2-preview
74
+
with:
75
+
distribution: 'adopt'
76
+
java-version: '11'
77
+
check-latest: true
78
+
- run: java -cp java HelloWorldApp
79
+
```
80
+
81
+
### Testing against different Java versions
63
82
```yaml
64
83
jobs:
65
84
build:
@@ -89,7 +108,7 @@ jobs:
89
108
- [Testing against different platforms](docs/advanced-usage.md#Testing-against-different-platforms)
90
109
- [Publishing using Apache Maven](docs/advanced-usage.md#Publishing-using-Apache-Maven)
91
110
- [Publishing using Gradle](docs/advanced-usage.md#Publishing-using-Gradle)
0 commit comments