问题描述
是否可以为在Travis上运行的作业指定JDK的次要版本?我有一个JavaFX项目失败,因为正在使用JDK 1.8.0_31进行构建,其中该项目使用了一些仅在Java 1.8.0_40中提供的类(特别是Alert和Spinner).
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).
当前,我的.travis.yml文件如下所示:
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.
推荐答案
我终于使它起作用了.实际上,不建议使用此解决方案,因为它使用linuxbrew来安装Oracle JDK 8.0_40.感谢 Github上的zrcoder ,我最终得到了这个.travis.yml
:
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
尽管这可行,但是Travis-CI应该在下个月更新,因此请更新配置以缩短构建时间.
Although this works, Travis-CI should be updated by next month, so update your config for shorter build times.
这篇关于您可以为travis ci指定次要的jdk版本吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!