version: 2
jobs:
    build:
        working_directory: ~/glowstone
        docker:
            - image: circleci/openjdk:8-jdk-browsers
        steps:
            - checkout
            - restore_cache:
                key: glowstone-{{ checksum "pom.xml" }}
            - run: mvn dependency:go-offline
            - save_cache:
                paths:
                 - ~/.m2
                 key: glowstone-{{ checksum "pom.xml" }}
             - run: mvn -B -s .circleci/maven.xml javadoc:javadoc javadoc:jar deploy
             - run: mv target/site/apidocs ./glowstone
             - run: zip -r javadocs.zip glowstone/
             - store_test_results:
                path: target/surefire-reports
            - store_artifacts:
                path: target/glowstone.jar
            - store_artifacts:
                path: javadocs.zip
