Since today we are having issues during builds on xenial environment.
Our TravisCI configuration has not changed since a while.
We use the openJDK 8 but the installation does not work as expected:
Installing openjdk8
OK
E: Unable to locate package temurin-8-jdk
$ export JAVA_HOME=/usr/lib/jvm/temurin-8-jdk-amd64
$ export PATH="/usr/lib/jvm/temurin-8-jdk-amd64/bin:/home/travis/bin:/home/travis/.local/bin:/usr/local/lib/jvm/openjdk11/bin:/opt/pyenv/shims:/home/travis/.phpenv/shims:/home/travis/perl5/perlbrew/bin:/home/travis/gopath/bin:/home/travis/.gimme/versions/go1.11.1.linux.amd64/bin:/usr/local/maven-3.6.3/bin:/usr/local/cmake-3.12.4/bin:/usr/local/clang-7.0.0/bin:/home/travis/.nvm/versions/node/v8.12.0/bin:/home/travis/.rvm/gems/ruby-2.5.3/bin:/home/travis/.rvm/gems/ruby-2.5.3@global/bin:/home/travis/.rvm/rubies/ruby-2.5.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/home/travis/.rvm/bin:/home/travis/.phpenv/bin:/opt/pyenv/bin:/home/travis/.yarn/bin"
update-java-alternatives: directory does not exist: /usr/lib/jvm/temurin-8-jdk*
...
$ mvn --settings .travis.settings.xml install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE
It appears as though java 11 is being set up instead of java 8. From a openjdk8 build 21 hours ago:
Installing openjdk8
*snip*
$ java -Xmx32m -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-8u292-b10-0ubuntu1~16.04.1-b10)
OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)
$ javac -J-Xmx32m -version
javac 1.8.0_292
On a failing build run a few minutes ago:
Installing openjdk8
*snip*
$ java -Xmx32m -version
openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
$ javac -J-Xmx32m -version
javac 11.0.2
$ pipenv run ant $ANT_TEST
Error: JAVA_HOME is not defined correctly.
We cannot execute /usr/lib/jvm/temurin-8-jdk-amd64/bin/java
The command "pipenv run ant $ANT_TEST" exited with 1.
Documentation on The Xenial Build Environment - Travis CI is also incorrect (which states that OpenJDK 8 is the default JDK – it defaults to OpenJDK 11), so trying to use the alleged default JDK will not work.
We have made some changes in managing multiple JDK versions within our image. Your builds should be OK from now on. Please let us know if you still encounter problems with JDK.
I’m still seeing this issue with jdk: oraclejdk13 leading to ERROR: JAVA_HOME is set to an invalid directory: /usr/lib/jvm/java-13-amazon-corretto when verifying before installing (none of this bit of code has changed in years, and was working within the last two days)