Installing a specific JDK 11 environment for Maven builds

I need to configure our Maven-based builds to run with a version of Open JDK 11 that fixes this Race condition in TLS 1.3 session resumption issue, triggered by at least one repository we need to access.

Obviously I can temporarily use the workaround of disabling TLS 1.3, but that’s not sustainable in the long term.

All the commentary here, and elsewhere, about installing different JDK versions point to the install-jdk.sh script, but that doesn’t get me a build beyond 11.0.2 (the same one I get with jdk set to openjdk11 in our dot-travis file) because it really only looks in a properties file where someone has previously worked out the links.

Ideally I’d be able to use Amazon’s Corretto builds, for consistency with our local development environments.

What’s a good, efficient, maintainable, supported approach, to do this? We’re currently using the Xenial build environment, if that makes a difference.

Hey @jrg,

As you stated, install-jdk.sh is used by Travis internally, let’s say if you wanted to use 11.0.4, so you’ll need to specifically install AdoptOpenJDK 11.0.4 (Linux, HotSpot) since Travis does not offer it by default. This is a sample .travis.yml I have created.

before_script:
        - wget -O /tmp/install-jdk.sh https://github.com/sormuras/bach/raw/master/install-jdk.sh
        - >-
          source /tmp/install-jdk.sh
          --url 'https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.4%2B11/OpenJDK11U-jdk_x64_linux_hotspot_11.0.4_11.tar.gz'
      script: >-
        mvn clean install -Pcontrib-check,jsUnitTests
        -Dmaven.surefire.arguments="-Duser.language=en -Duser.region=US"
        | grep -v -F -f .travis-output-filters
        && exit ${PIPESTATUS[0]}

There’s also something called SDKMAN, that some people have had success with I’ll ask some colleagues tomorrow to see if there’s a rational fix for this. Xenial should be just fine.