language: java

sudo: false
# Flaky - see https://github.com/travis-ci/travis-ci/issues/3566
#cache:
#  directories:
#      - $HOME/.m2

script: if [[ -v COMMAND ]]; then $COMMAND; else travis_retry mvn -q -Dorg.slf4j.simpleLogger.defaultLogLevel=WARN -Dorg.slf4j.simpleLogger.log.org.killbill.billing.util.cache=ERROR -Dorg.slf4j.simpleLogger.log.org.killbill.billing.lifecycle=ERROR clean install $PHASE 2>&1 | egrep -v 'Download|Install|[ \t]*at [ \ta-zA-Z0-9\.\:\(\)]+'; [ ${PIPESTATUS[0]} == 0 ]; fi
# Remove --quiet to avoid timeouts
install: mvn -U install -DskipTests=true | egrep -v 'Download|Install'

notifications:
  email:
    - kill-bill-commits@googlegroups.com

env:
  global:
    - MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=192m"

matrix:
  allow_failures:
    - jdk: oraclejdk8
  include:
    - env: PHASE="-Ptravis"
      jdk: openjdk7
    - env: PHASE="-Ptravis"
      jdk: oraclejdk7
    - env: PHASE="-Ptravis,jdk17"
      jdk: openjdk7
    - env: PHASE="-Ptravis,jdk17"
      jdk: oraclejdk7
    - env: PHASE="-Ptravis,jdk18"
      jdk: oraclejdk8
  fast_finish: true

after_success:
  - '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && echo "<settings><servers><server><id>sonatype-nexus-snapshots</id><username>\${env.OSSRH_USER}</username><password>\${env.OSSRH_PASS}</password></server></servers></settings>" > ~/settings.xml && travis_wait mvn deploy -DskipTests=true --settings ~/settings.xml | egrep -v "Download|Install|Upload" ; rm -f ~/settings.xml'
