version: 2
jobs:
    build:
        docker:
            - image: dockerfile/java:oracle-java8

        working_directory: ~/repo

        environment:
            JVM_OPTS: -Xmx3200m
            TERM: dumb

        steps:
            - checkout

            - restore_cache:
                keys:
                    - v1-dependencies-{{ checksum "build.gradle" }}
                    - v1-dependencies-

            - run:
                name: Download dependencies
                command: ./gradlew dependencies

            - save_cache:
                paths:
                    - ~/.m2
                key: v1-dependencies-{{ checksum "build.gradle" }}

            - run:
                name: Run tests
                command: ./gradlew clean test

            - run:
                name: Save reports
                command: |
                    mkdir -p ~/test-reports/
                    find . -type f -regex "./build/test-results/.*xml" -exec cp {} ~/test-reports/ \;
                when: always

            - store_test_results:
                path: ~/test-reports/

            - store_artifacts:
                path: ~/test-reports/

version: 2
jobs:
    build:
        docker:
            - image: circleci/java:8-jdk

        working_directory: ~/repo

        environment:
            JVM_OPTS: -Xmx3200m
            TERM: dumb

        steps:
            - checkout

            - restore_cache:
                keys:
                    - v1-dependencies-{{ checksum "build.gradle" }}
                    - v1-dependencies-

            - run:
                name: Download dependencies
                command: ./gradlew dependencies

            - save_cache:
                paths:
                    - ~/.m2
                key: v1-dependencies-{{ checksum "build.gradle" }}

            - run:
                name: Run tests
                command: ./gradlew clean test

            - run:
                name: Save reports
                command: |
                    mkdir -p ~/test-reports/
                    find . -type f -regex "./build/test-results/.*xml" -exec cp {} ~/test-reports/ \;
                when: always

            - store_test_results:
                path: ~/test-reports/

            - store_artifacts:
                path: ~/test-reports/

Use circleci official Oracle Java 8
Use circleci official Oracle Java 8
