How to use Java 10+ with Travis CI
As of today, Travis CI only supports Java ≤ 9.
But you can download and use another version of the JDK for your Travis CI build. There is a shell-script in the Java Shell Builder project that determines the most recent (early-access) build number (for the JDK version you want), downloads the JDK archive to the user home directory and extracts it there.
I’ve taken some lines from the .travis.yml file from the JUnit 5 project, which is using the mentioned shell-script, to use them in my Java 9/10+ features sample project on GitHub. With the following lines you can use the latest Open-/Oracle JDK 10 builds to run your Travis CI script.
language: java dist: trusty sudo: false before_install: matrix: include: script: - ./gradlew --version - ./gradlew test