Cache Maven artifacts with GitHub Actions View article history Edit article

Published: , Updated:
Talks about: <a class="post-tag post-tag-cache" href="/tags/cache">cache</a>, <a class="post-tag post-tag-github" href="/tags/github">github</a>, <a class="post-tag post-tag-github-actions" href="/tags/github-actions">github actions</a>, and <a class="post-tag post-tag-maven" href="/tags/maven">maven</a>

The actions/cache action allows to cache artifacts in your GitHub Action.

name: <PIPELINE>
jobs:
  build:
    runs-on: <RUN_ON>
    steps:
      - name: Cache Maven artifacts
        uses: actions/cache@v1
        with:
          path: ~/.m2/repository
          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
          restore-keys: |
            ${{ runner.os }}-maven-