@@ -20,7 +20,17 @@ function openjdk::install_openjdk_via_jvm_common_buildpack() {
2020 local jvm_common_buildpack_dir
2121 jvm_common_buildpack_dir=$( mktemp -d)
2222
23- curl --silent --show-error --fail --retry 3 --retry-connrefused --connect-timeout 5 --location " ${jvm_common_buildpack_tarball_url} " -o " ${jvm_common_buildpack_tarball_path} "
23+ curl \
24+ --connect-timeout " ${CURL_CONNECT_TIMEOUT:- 3} " \
25+ --max-time " ${CURL_TIMEOUT:- 60} " \
26+ --retry 5 \
27+ --retry-connrefused \
28+ --no-progress-meter \
29+ --fail \
30+ --location \
31+ " ${jvm_common_buildpack_tarball_url} " \
32+ -o " ${jvm_common_buildpack_tarball_path} "
33+
2434 tar -xzm --directory " ${jvm_common_buildpack_dir} " --strip-components=1 -f " ${jvm_common_buildpack_tarball_path} "
2535
2636 # This script translates non-JDBC compliant DATABASE_URL (and similar) environment variables into their
@@ -30,9 +40,18 @@ function openjdk::install_openjdk_via_jvm_common_buildpack() {
3040 # shellcheck source=/dev/null
3141 source " ${jvm_common_buildpack_dir} /opt/jdbc.sh"
3242
33- # shellcheck source=/dev/null
34- source " ${jvm_common_buildpack_dir} /bin/java"
43+ # Run the main installation in a sub-shell to avoid it overriding library functions and global
44+ # variables in the host buildpack.
45+ (
46+ # shellcheck source=/dev/null
47+ source " ${jvm_common_buildpack_dir} /bin/java"
48+
49+ # See: https://github.com/heroku/heroku-buildpack-jvm-common/blob/main/bin/java
50+ install_openjdk " ${build_dir} " " ${host_buildpack_dir} "
51+ )
3552
36- # See: https://github.com/heroku/heroku-buildpack-jvm-common/blob/main/bin/java
37- install_openjdk " ${build_dir} " " ${host_buildpack_dir} "
53+ # Since we run install_openjdk in a sub-shell, any environment variables set by it will not be available in this
54+ # (parent) shell. As documented in the jvm buildpack, we can source the modified export script from this (host)
55+ # buildpack to get the necessary changes.
56+ source " ${host_buildpack_dir} /export"
3857}
0 commit comments