This commit is a manual backport of #15628 on the 7.17 branch.
Since 7.17 uses Java 11, we switch to the adoptium variant, which is
still receiving updates (latest available is `11.0.21+9` as of now.)
Backport PR #13369 to 7.16 branch. Original message:
Add ability to pull the version used to build java from the logstash repo, rather
than rely on system Java. Previously, builds would use JAVA_HOME, now this setting
is ignored in Logstash (and by extension, parts of the Logstash build), which was causing
variations in the version of Java used to build Logstash, including the use of Java 8,
which the Logstash team would like to remove support for.
Relates: https://github.com/elastic/infra/pull/32818