title: GitHub Actions: Cache Maven .m2 repository on Windows environment C\:\\Users\runneradmin\\.m2\repository: Cannot stat: No such file or directory
body: <p><a href="https://docs.github.com/en/actions/guides/building-and-testing-java-with-maven#caching-dependencies" rel="nofollow noreferrer">As the docs state</a> in order to cache the Maven dependencies with GitHub Actions all we have to use is the <a href="https://github.com/actions/cache" rel="nofollow noreferrer">actions/cache</a> action like this:</p>
  <pre><code>steps:
    - uses: actions/checkout@v2
    - name: Set up JDK 1.8
      uses: actions/setup-java@v1
      with:
        java-version: 1.8
    - name: Cache Maven packages
      uses: actions/cache@v2
      with:
        path: ~/.m2
        key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
        restore-keys: ${{ runner.os }}-m2
    - name: Build with Maven
      run: mvn --batch-mode --update-snapshots verify
  </code></pre>
  <p>However using the <code>windows-2016</code> GitHub Actions environment, this doesn't provides us with a working cache - <a href="https://github.com/codecentric/spring-boot-admin/runs/2225817750?check_suite_focus=true" rel="nofollow noreferrer">as the logs states</a>:</p>
  <pre><code>Post job cleanup.
  &quot;C:\Program Files\Git\usr\bin\tar.exe&quot; --posix --use-compress-program &quot;zstd -T0&quot; -cf cache.tzst -P -C D:/a/spring-boot-admin/spring-boot-admin --files-from manifest.txt --force-local
  /usr/bin/tar: C\:\\Users\runneradmin\\.m2\repository: Cannot stat: No such file or directory
  /usr/bin/tar: Exiting with failure status due to previous errors
  Warning: Tar failed with error: The process 'C:\Program Files\Git\usr\bin\tar.exe' failed with exit code 2
  </code></pre>
  <p>How to fix this?</p>