Travis Ci jdk_switcher for custom java installation

I am developing a Java application that needs the latest version of java. Unfortunately, travis-ci currently only supports jdk version 1.8.0_31.

Because of this, I download the newes binary release from oracle and extract it into the $ HOME directory:

before-script:
    - "wget --no-cookies --header \"Cookie: oraclelicense=accept-securebackup-cookie\" http://download.oracle.com/otn-pub/java/jdk/8u60-b27/jdk-8u60-linux-x64.tar.gz -O /tmp/OracleJDK.tar.gz"
    - tar -xzvf /tmp/OracleJDK.tar.gz -C $HOME
    - export PATH=$PATH:$HOME/jdk1.8.0_60/bin
    - jdk_switcher use <???>

How to tell travis to use jdk just loaded?

BTW: I am not updating jdk via apt-get because sudo commands are not yet supported with their new docker infrastructure.

+4
source share
2 answers

I solved this using the hadron hadron travis as follows:

jdk:
  - oraclejdk8

addons:
  apt:
    packages:
      - oracle-java8-installer

This automatically installs the latest version of java8 without using sudo

+7
source

oracle-java8-set-default:

jdk:
  - oraclejdk8
addons:
  apt:
    packages:
      - oracle-java8-installer
      - oracle-java8-set-default

.

+2

All Articles