version: 0.2

phases:
  install:
    runtime-versions:
      java: "$JAVA_RUNTIME"

  build:
    commands:
      - mvn clean install -T0.4C $MAVEN_OPTIONS
      - JAVA_VERSION=$(java -version 2>&1 | grep -i version | cut -d'"' -f2 | cut -d'.' -f1-1)
      - echo $JAVA_VERSION
      - echo $MAVEN_OPTIONS
      - |
        if [ "$JAVA_VERSION" -ge "9" ]; then
          cd test/module-path-tests
          mvn package
          mvn exec:exec -P mock-tests
        fi
    finally:
      - mkdir -p codebuild-test-reports
      - find ./ -name 'TEST-*.xml' -type f -exec cp {} codebuild-test-reports/ \;
reports:
  UnitTests:
    files:
      - 'codebuild-test-reports/**/*'
