14

I have a problem with installing openjdk11 in Travis CI.

This is the error I'm getting

Installing openjdk11
$ export JAVA_HOME=~/openjdk11
$ export PATH="$JAVA_HOME/bin:$PATH"
$ ~/bin/install-jdk.sh --target "/home/travis/openjdk11" --workspace "/home/travis/.cache/install-jdk" --feature "11" --license "GPL" --cacerts
install-jdk.sh 2019-04-18
The command "~/bin/install-jdk.sh --target "/home/travis/openjdk11" --workspace "/home/travis/.cache/install-jdk" --feature "11" --license "GPL" --cacerts" failed and exited with 51 during .
Your build has been stopped.

.travis.yml file:

language: java
jdk: openjdk11
cache:
  directories:
    - "$HOME/.m2/repository"
Juliano Macedo
  • 433
  • 4
  • 15
Sushmitha M
  • 143
  • 6

3 Answers3

7

It seems to be an TLS certificate error of download.java.net. Current TLS certificate exposed by download.java.net is invalid: it's for download.oracle.com.

The 51 return code was returned by the curl download command.

You can download the install-jdk.sh script :

curl -o /tmp/install-jdk.sh -L https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh

Then run it:

bash -x /tmp/install-jdk.sh --target "/home/travis/openjdk11" --workspace "/home/travis/.cache/install-jdk" --feature "11" --license "GPL" --cacerts

Failing command is:

curl -o /dev/null --silent --head --write-out '%{http_code}' https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_osx-x64_bin.tar.gz

with a 51 return code

Pierre G
  • 81
  • 5
  • Download URL has been fixed : https://github.com/sormuras/bach/commit/db42afccd2c40c903ddf73156f304c2276517c6c#diff-08dca971d5e4fbd0624e7bf955f5adb1. `download.oracle.com` is used instead of `download.java.net` – Pierre G Apr 30 '19 at 06:39
6

To avoid this problem, try something like this in your .travis.yml configuration file:

language: java
dist: xenial
sudo: required

jdk:
  - openjdk11
Juliano Macedo
  • 433
  • 4
  • 15
1

Probably Oracle has to fix their TLS certificate or Travis has to fix it somehow on their end.

In the meantime, we had some luck by adding dist: xenial to our Travis configuration, see: https://travis-ci.community/t/install-of-openjdk11-is-failing-again/3061/16

Another solution seems to be to add oraclejdk11 to the jdk list in the Travis configuration.

I wouldn't particularly say that these are actual solutions but mere workarounds for the time being.

tobihagemann
  • 551
  • 7
  • 13