How to cache Maven dependencies

If you are using Cache:Push version 1.0.0 or above

In this case you will need to put only $HOME/.m2 in cache_paths, and leave ignore_check_on_paths empty.

For example:

example:
  steps:
  - git-clone: {}
  - cache-pull: {}
  - gradle-runner:
      inputs:
      - gradle_file: "$BITRISE_PROJECT_PATH"
      - gradle_task: "$GRADLE_TASK"
  - cache-push:
      inputs:
      - cache_paths: |-
          $HOME/.m2
```


### In case if your Cache:Push step version is lower than 1.0.0

Your build process may use [Apache Maven](https://maven.apache.org/) repositories to fetch dependencies at runtime.
For example [Roboelectric](http://robolectric.org) testing framework uses [Sonatype](https://oss.sonatype.org/content/groups/public/)
to fetch target platforms and shadow-classes during a test run (unless explicitly [configured](http://robolectric.org/configuring/)).
Resolved dependencies are cached in a local Maven repository at `$HOME/.m2`

## Setup

To cache the `$HOME/.m2` directory follow these steps:   

1. Put the `Cache:Pull` step after the Git Clone
2. Put the `Cache:Push` step to the very end of the Workflow
3. Select the `Cache:Push` step and add the following paths for caching (__Cache paths__ input):
   ```
   $HOME/.m2
   ```

## Example workflow (gradle and maven caches)

```yml
example:
  steps:
  - git-clone: {}
  - cache-pull: {}
  - gradle-runner:
      inputs:
      - gradle_file: "$BITRISE_PROJECT_PATH"
      - gradle_task: "$GRADLE_TASK"
  - cache-push:
      inputs:
      - cache_paths: |-
          $HOME/.gradle
          ./.gradle
          $HOME/.m2
      - ignore_check_on_paths: |-
          $HOME/.gradle/caches/*.lock
          ./.gradle/*.lock
          ./.gradle/*.bin
```

__For more information about the Bitrise Build Cache see the [DevCenter](http://devcenter.bitrise.io/caching/about-caching/).__