18

Is it possible to specify the minor version of the JDK for jobs running on Travis? I have a JavaFX project which is failing because JDK 1.8.0_31 is being used to perform the build where as the project uses some classes that were only shipped in Java 1.8.0_40 (specifically Alert and Spinner).

Currently my .travis.yml file looks like below:

language: java

jdk:
  - oraclejdk8

Here's a link to the failed build just in case it's useful.

bmooney
  • 391
  • 6
  • 15
  • I'm facing the same issue. The easiest solution I see is accepting Oracles end user agreement, download the .tar.gz from their site, unpacking it, setting `$JAVA_HOME` yourself and using this for building. I'm currently trying to get openjfx running on Ubuntu 12.04 (that's what travis is using). So far I only found the openjdk, the openjfx package seems to be located somewhere else. I'm still investigating – michaeln May 09 '15 at 18:12

3 Answers3

6

This solution based on apt addon works for me:

language: java

jdk:
  - oraclejdk8

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

In result I have java version "1.8.0_91". The solution source is here

Andriy Kryvtsun
  • 3,220
  • 3
  • 27
  • 41
5

I finally got it working. This solution is not really reccommended as it uses linuxbrew to install Oracle JDK 8.0_40. Thanks to zrcoder on Github I ended up with this .travis.yml:

language: java

branches:
  only:
  - master

notifications:
  email: false

before_install:
    - rm -rf ~/.linuxbrew
    - yes | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"
    - export PATH="$HOME/.linuxbrew/bin:$PATH"
    - export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
    - export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
    - brew install jdk
    - export JAVA_HOME=/home/travis/.linuxbrew/Cellar/jdk/1.8.0-40

Although this works, Travis-CI should be updated by next month, so update your config for shorter build times.

michaeln
  • 1,032
  • 17
  • 33
-1

I recommend using Travis CI's Trusty build environment which uses newer software than the default Precise environment. It's quicker and more reliable than redownloading the newest JDK on each build.

Just add the following to the top level of .travis.yml

dist: trusty
Stevoisiak
  • 23,794
  • 27
  • 122
  • 225