Can you specify minor jdk version for travis ci

坚强是说给别人听的谎言 提交于 2019-12-06 17:16:36

问题


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.


回答1:


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.




回答2:


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




回答3:


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


来源:https://stackoverflow.com/questions/29636754/can-you-specify-minor-jdk-version-for-travis-ci

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!