Changes for README.md: 14 added lines, 0 removed lines.
Original line number
Diff line number
Diff line
@@ -69,6 +69,7 @@ Currently, the following distributions are supported:
The action has a built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/cache) under hood for caching dependencies but requires less configuration settings. Supported package managers are gradle and maven. The format of the used cache key is `setup-java-${{ platform }}-${{ packageManager }}-${{ fileHash }}`, where the hash is based on the following files:
The workflow output `cache-hit` is set to indicate if an exact match was found for the key [as actions/cache does](https://github.com/actions/cache/tree/main#outputs).
@@ -99,6 +100,19 @@ steps:
run:mvn -B package --file pom.xml
```
#### Caching sbt dependencies
```yaml
steps:
-uses:actions/checkout@v3
-uses:actions/setup-java@v3
with:
distribution:'temurin'
java-version:'11'
cache:'sbt'
-name:Build with SBT
run:sbt package
```
### Check latest
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.