language: java
sudo: false # faster builds

jdk:
  - openjdk11
  - openjdk8

cache:
  directories:
    - $HOME/.m2

install: true

before_script:
  - if [ "$TRAVIS_JDK_VERSION" == "openjdk8" ]; then
    export IMAGE_NAME="openjdk:8u212-jre-alpine";
    fi
  - if [ "$TRAVIS_JDK_VERSION" == "openjdk11" ]; then
    export IMAGE_NAME="openjdk:11-jre-stretch";
    fi

script:
  - if [ "$TRAVIS_BRANCH" == "develop" ] && [ "$TRAVIS_PULL_REQUEST" == false ]; then
    travis_wait 30 ./mvnw clean install -DskipTests=false -Dcheckstyle.skip=false -Dlicense.skip=false -P image -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
    else
    travis_wait 30 ./mvnw clean install -DskipTests=false -Dcheckstyle.skip=false -Dlicense.skip=false -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
    fi
after_success:
  - bash <(curl -s https://codecov.io/bash)
