You can now run Java projects faster on GitHub Actions by enabling dependency caching on the setup-java action. setup-java supports caching for both Gradle and Maven projects.

The following example enables caching for a Java project with Gradle:

- uses: actions/checkout@v2
- uses: actions/setup-java@v2
    distribution: 'temurin'
    java-version: '11'
    cache: 'gradle'
- run: ./gradlew build

For additional examples, visit the setup-java repository.