Skip to content
This repository was archived by the owner on Nov 30, 2023. It is now read-only.

Commit 898c459

Browse files
authored
Work around issue with SDKMAN's default not downloading
1 parent 888ef65 commit 898c459

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

script-library/docs/java.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Or as a feature:
2424

2525
|Argument| Feature option |Default|Description|
2626
|--------|----------------|-------|-----------|
27-
|Java version| `version` | `lts`| Version of Java to install. Specify `lts` to install the LTS version. |
27+
|Java version| `version` | `latest`| Version of Java to install. Specify `latest` to install the latest supported Microsoft JDK or `lts` for the latest LTS version. Specify `default` to install default version SDKMAN provides. |
2828
|SDKMAN_DIR| | `/usr/local/sdkman`| Location to find [SDKMAN!](https://sdkman.io/), or if not found, where to install it. |
2929
|Non-root user| | `automatic`| Specifies a user in the container other than root that will use Gradle. A value of `automatic` will cause the script to check for a user called `vscode`, then `node`, `codespace`, and finally a user with a UID of `1000` before falling back to `root`. |
3030
| Add to rc files flag | | `true` | A `true`/`false` flag that indicates whether sourcing the nvm script should be added to `/etc/bash.bashrc` and `/etc/zsh/zshrc`. |

script-library/java-debian.sh

+5-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#
1010
# Syntax: ./java-debian.sh [JDK version] [SDKMAN_DIR] [non-root user] [Add to rc files flag]
1111

12-
JAVA_VERSION=${1:-"default"}
12+
JAVA_VERSION=${1:-"lts"}
1313
export SDKMAN_DIR=${2:-"/usr/local/sdkman"}
1414
USERNAME=${3:-"automatic"}
1515
UPDATE_RC=${4:-"true"}
@@ -82,7 +82,7 @@ sdk_install() {
8282
local suffix="${4:-"\\s*"}"
8383
local full_version_check=${5:-".*-[a-z]+"}
8484
if [ "${requested_version}" = "none" ]; then return; fi
85-
# Blank will install latest stable version
85+
# Blank will install latest stable version SDKMAN has
8686
if [ "${requested_version}" = "lts" ] || [ "${requested_version}" = "default" ]; then
8787
requested_version=""
8888
elif echo "${requested_version}" | grep -oE "${full_version_check}" > /dev/null 2>&1; then
@@ -137,6 +137,9 @@ jdk_distro="ms"
137137
if echo "${JAVA_VERSION}" | grep -E '^8([\s\.]|$)' > /dev/null 2>&1; then
138138
jdk_distro="tem"
139139
fi
140+
if [ "${JAVA_VERSION}" = "lts" ]; then
141+
JAVA_VERSION="17"
142+
fi
140143
sdk_install java ${JAVA_VERSION} "\\s*" "(\\.[a-z0-9]+)*-${jdk_distro}\\s*" ".*-[a-z]+$"
141144

142145
echo "Done!"

0 commit comments

Comments
 (0)