diff --git a/images/linux/scripts/installers/java-tools.sh b/images/linux/scripts/installers/java-tools.sh index 2220c13ee..cc15bbe39 100644 --- a/images/linux/scripts/installers/java-tools.sh +++ b/images/linux/scripts/installers/java-tools.sh @@ -53,7 +53,12 @@ installOpenJDK() { # https://github.com/adoptium/temurin-build/issues/2248 [[ ${fullJavaVersion} =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+ ]] && fullJavaVersion=$(echo $fullJavaVersion | sed -E 's/\.[0-9]+-/-/') + # When version string is too short, add extra ".0" to make it valid semver + [[ ${fullJavaVersion} =~ ^[0-9]+- ]] && fullJavaVersion=$(echo $fullJavaVersion | sed -E 's/-/.0-/') + [[ ${fullJavaVersion} =~ ^[0-9]+\.[0-9]+- ]] && fullJavaVersion=$(echo $fullJavaVersion | sed -E 's/-/.0-/') + javaToolcacheVersionPath="${JAVA_TOOLCACHE_PATH}/${fullJavaVersion}" + echo "Java ${JAVA_VERSION} Toolcache Version Path: ${javaToolcacheVersionPath}" mkdir -p "${javaToolcacheVersionPath}" # Create a complete file diff --git a/images/linux/scripts/tests/Java.Tests.ps1 b/images/linux/scripts/tests/Java.Tests.ps1 index a93fbdcb6..7a5c2eb67 100644 --- a/images/linux/scripts/tests/Java.Tests.ps1 +++ b/images/linux/scripts/tests/Java.Tests.ps1 @@ -45,6 +45,6 @@ Describe "Java" { if ($Version -eq 8) { $Version = "1.${Version}" } - "`"$javaPath`" -version" | Should -MatchCommandOutput ([regex]::Escape("openjdk version `"${Version}.")) + "`"$javaPath`" -version" | Should -MatchCommandOutput "openjdk\ version\ `"${Version}(\.[0-9_\.]+)?`"" } } diff --git a/images/linux/toolsets/toolset-2004.json b/images/linux/toolsets/toolset-2004.json index 7eaa4a0dc..dd8bfabe8 100644 --- a/images/linux/toolsets/toolset-2004.json +++ b/images/linux/toolsets/toolset-2004.json @@ -74,7 +74,7 @@ ], "java": { "default": "11", - "versions": [ "8", "11", "17" ], + "versions": [ "8", "11", "17", "21"], "maven": "3.8.8" }, "android": { diff --git a/images/linux/toolsets/toolset-2204.json b/images/linux/toolsets/toolset-2204.json index 6001c348f..690799a79 100644 --- a/images/linux/toolsets/toolset-2204.json +++ b/images/linux/toolsets/toolset-2204.json @@ -68,7 +68,7 @@ ], "java": { "default": "11", - "versions": [ "8", "11", "17" ], + "versions": [ "8", "11", "17", "21"], "maven": "3.8.8" }, "android": {