language: java

sudo: required

env:
  - jdk_target=oraclejdk8
  - jdk_target=openjdk8

before_install:
  - if [["$jdk_target" == "openjdk8"]]; then sudo add-apt-repository ppa:openjdk-r/ppa -y; fi
  - if [["$jdk_target" == "oraclejdk8"]]; then sudo add-apt-repository ppa:webupd8team/java -y; fi
  - sudo apt-get update -qq

install:
  - if [["$jdk_target" == "openjdk8"]]; then sudo apt-get install openjdk-8 -y; fi
  - if [["$jdk_target" == "openjdk8"]]; then sudo apt-get install openjfx -y; fi
  - if [["$jdk_target" == "oraclejdk8"]]; then sudo apt-get install --no-install-recommends oracle-java8-installer -y; fi

before_script:
  - jdkswitcher use $jdk_target
  - git submodule update --init --recursive
  - chmod +x mvn

script:
  - mvn clean install -DskipTests=true -Dgpg.skip=true
  - mvn clean test -Dgpg.skip=true

cache:
  directories:
  - ${HOME}/.m2

language: java

os: linux

sudo: required

matrix:
    include:
        - jdk: oraclejdk7 
          env: jdk=oraclejdk7 custom_jdk=false
            
        - jdk: openjdk7 
          env: jdk=openjdk7 custom_jdk=false
        
        - env: jdk=oraclejdk8 custom_jdk=true
        
        - env: jdk=openjdk8 custom_jdk=true        
        
before_install:
  - if [["$jdk" == "openjdk8"]]; then sudo add-apt-repository ppa:openjdk-r/ppa -y; fi
  - if [["$jdk" == "oraclejdk8"]]; then sudo add-apt-repository ppa:webupd8team/java -y; fi

  - sudo apt-get update -qq -y

install:
  - if [["$jdk" == "openjdk8"]]; then sudo apt-get install openjdk-8 -y; fi
  - if [["$jdk" == "openjdk8"]]; then sudo apt-get install openjfx -y; fi
  - if [["$jdk" == "oraclejdk8"]]; then sudo apt-get install --no-install-recommends oracle-java8-installer -y; fi

before_script:
  - if [["$custom_jdk" == "true"]]; then jdkswitcher use $jdk_target && jdkswitcher home; fi

  - git submodule update --init --recursive
  - chmod +x mvn

script:
  - mvn clean install -DskipTests=true -Dgpg.skip=true
  - mvn clean test -Dgpg.skip=true

cache:
  directories:
  - ${HOME}/.m2

Improve and refine Travis-CI configuration
Improve and refine Travis-CI configuration

Instead of using the env key as an improper stand-in for the built in
matrix feature, replace the env key values with an equivalent matrix
declaration. Modify the execution of the jdkswitcher program to only
occur if the custom_jdk variable is true. Controlling the execution of
jdk_switcher with a conditional should hopefully allow use to use the
built in jdk key for non-custom builds with officially supported JDK
versions and vendors. Before this change the jdkswitcher would smudge
the build machines JAVA_HOME in a way that might break official
Travis-CI Java builds.

A fix to the apt-get update command was made by adding a -y option;
previously the command would have waited for the interactive input of
a yes/no question, which would have broken the build (since the
Travis-CI builder is not interactive). All builds now explicitly state
that they should be built via the Linux OS with root access available
via sudo. An attempt was made to remove the need for sudo use and switch
to the much container builders (which have much faster spinup), but the
apt addon (the only alternative to using sudo) does not support the
needed Bash shell conditionals we use to allow both officially supported
and unsupported JDK versions.

Signed-off-by: Emily Mabrey <3d36c4a9b71c8057f58fe5b123154f7eebd91aac@gmail.com>
