travis-ci / docs-travis-ci-com

The Travis CI Documentation
http://docs.travis-ci.com
587 stars 3.21k forks source link

List of supported JVMs on Ubuntu Focal incorrect (OpenJDK 8 unsupported) #2902

Open joschi opened 3 years ago

joschi commented 3 years ago

According to the documentation about the Ubuntu 20.04 (Focal Fossa) Build Environment, it should come with OpenJDK 8 preinstalled:

Pre-installed JVMs: openjdk8, openjdk10, and openjdk11 on x86, default is openjdk11.

https://docs.travis-ci.com/user/reference/focal/#jvm-clojure-groovy-java-scala-support https://github.com/travis-ci/docs-travis-ci-com/blame/f6814e6281e1036b6ca056b49106cabcdc74e77e/user/reference/focal.md#L137

Unfortunately this is incorrect and only OpenJDK 9 and later seem to be supported:

$ ~/bin/install-jdk.sh --target "/home/travis/openjdk8" --workspace "/home/travis/.cache/install-jdk" --feature "8" --license "GPL" --cacerts
Ignoring license option: GPL -- using GPLv2+CE by default
install-jdk.sh 2020-06-02
Expected feature release number in range of 9 to 16, but got: 8
The command "~/bin/install-jdk.sh --target "/home/travis/openjdk8" --workspace "/home/travis/.cache/install-jdk" --feature "8" --license "GPL" --cacerts" failed and exited with 3 during .

Source: https://travis-ci.com/github/dropwizard/dropwizard/jobs/403800987#L170-L174

There is also an unanswered topic in the Travis CI Community about this: https://travis-ci.community/t/openjdk8-setup-fails-on-focal/9760/2

Given that Java 8 is still in wide use, it would be great if support for OpenJDK 8 could be added to the Ubuntu 20.04 (Focal Fossa) Build Environment.

sormuras commented 3 years ago

Perhaps related to https://github.com/sormuras/bach/issues/72?

joschi commented 3 years ago

@sormuras The message is a different one and the --feature seems to be checked before anything is being downloaded.

joschi commented 3 years ago

@sormuras 🤷 https://github.com/sormuras/bach/blob/f40133b040a391392ae8ab63eb54126693a1eb58/install-jdk.sh#L189-L191 https://github.com/sormuras/bach/commit/d35b7ddaa5ef9b05141cbfdd45733ff126856b38 https://github.com/sormuras/bach/issues/62

sormuras commented 3 years ago

Ah, ok.

install-jdk.sh shouldn't be called for JDK versions below 9 at all, and for 9 to 14 (as of today) only for non-production related tasks. See https://travis-ci.community/t/java-jdk-on-travis-ci/1380 for details.

joschi commented 3 years ago

install-jdk.sh shouldn't be called for JDK versions below 9 at all, and for 9 to 14 (as of today) only for non-production related tasks.

That's something which Travis CI has to fix or make very clear that OpenJDK 8 is not supported on the Ubuntu Focal build environment out of the box. 😉

hnarayanan commented 3 years ago

I understand that this is not working out of the box, but could someone point me to any working instructions on how to setup OpenJDK 8 on Focal. Nearly everything I've tried appears to be out-of-date documentation.

joschi commented 3 years ago

@hnarayanan You could install Zulu Community as described here: https://docs.azul.com/zulu/zuludocs/ZuluUserGuide/PrepareZuluPlatform/AttachAPTRepositoryUbuntuOrDebianSys.htm

hnarayanan commented 3 years ago

Thank you. I went with a different approach and document the solution below in case it helps anyone. In the following example, I am trying to set up an older Java for an older elasticsearch. In .travis.yml:

before_install:
  - sudo apt-get install -y openjdk-8-jdk
before_script:
  - echo JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 | sudo tee -a /etc/default/elasticsearch

Alternatively you can just export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 or add it to your path before your scripts.

stale[bot] commented 2 years ago

Thanks for contributing to this issue. As it has been 90 days since the last activity, we are automatically closing the issue. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If that's not the case, please do feel free to either reopen this issue or open a new one. We'll gladly take a look again! You can read more here: https://blog.travis-ci.com/2018-03-09-closing-old-issues