Skip to content

Commit 89b715b

Browse files
committed
Fix shell script syntax errors after removing 'local' keywords
Remove orphaned variable declarations that were left after removing 'local' keywords. These were causing syntax errors in the shell script. Fixed: - Removed standalone variable declarations without assignments - All variables now properly initialized when used - Shell script syntax is now valid - Shellcheck passes without errors This completes the POSIX sh compatibility fix for PR #330.
1 parent 5bf45e1 commit 89b715b

File tree

1 file changed

+0
-7
lines changed
  • maven-wrapper-distribution/src/resources

1 file changed

+0
-7
lines changed

maven-wrapper-distribution/src/resources/only-mvnw

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ get_sdkman_version() {
202202
# Handle major version resolution by querying SDKMAN API
203203
if echo "$version" | grep -q '^[0-9]\+$'; then
204204
# This is a major version, get the latest from SDKMAN
205-
latest_version
206205
latest_version="$(get_latest_version_from_sdkman "$version" "$suffix")"
207206
if [ -n "$latest_version" ]; then
208207
version="$latest_version"
@@ -230,7 +229,6 @@ get_latest_version_from_sdkman() {
230229

231230
# Check cache if it exists and is less than 24 hours old
232231
if [ -f "$cache_file" ]; then
233-
cache_age
234232
if command -v stat >/dev/null; then
235233
# Linux/macOS stat command
236234
if stat -c %Y "$cache_file" >/dev/null 2>&1; then
@@ -245,7 +243,6 @@ get_latest_version_from_sdkman() {
245243
age_hours=$(((current_time - cache_age) / 3600))
246244

247245
if [ "$age_hours" -lt 24 ]; then
248-
cached_version
249246
cached_version="$(cat "$cache_file" 2>/dev/null)"
250247
if [ -n "$cached_version" ]; then
251248
verbose "Using cached JDK version: ${major_version} -> ${cached_version}"
@@ -258,7 +255,6 @@ get_latest_version_from_sdkman() {
258255

259256
# Query SDKMAN API for all available versions
260257
versions_api_url="https://api.sdkman.io/2/candidates/java/${platform}/versions/all"
261-
all_versions
262258

263259
verbose "Querying SDKMAN API for JDK versions: $versions_api_url"
264260

@@ -278,7 +274,6 @@ get_latest_version_from_sdkman() {
278274

279275
# Find the latest version for the major version and vendor
280276
# SDKMAN returns versions in a comma-separated list
281-
latest_version
282277
latest_version="$(echo "$all_versions" | tr ',' '\n' | grep "^${major_version}\." | grep -- "${vendor_suffix}\$" | head -1 | sed "s/${vendor_suffix}\$//")"
283278

284279
if [ -n "$latest_version" ]; then
@@ -399,7 +394,6 @@ install_jdk() {
399394
mkdir -p "${jdk_home%/*}"
400395

401396
# Prepare temp dir for JDK download
402-
jdk_tmp_dir
403397
if jdk_tmp_dir="$(mktemp -d)" && [ -d "$jdk_tmp_dir" ]; then
404398
jdk_clean() { rm -rf -- "$jdk_tmp_dir"; }
405399
trap jdk_clean HUP INT TERM EXIT
@@ -477,7 +471,6 @@ install_jdk() {
477471

478472
# Search for bin/java in the extracted content (up to 4 levels deep to handle various archive structures)
479473
# Use find to be more thorough than shell globbing
480-
java_executable
481474
java_executable=$(find "$jdk_extract_dir" -name "java" -type f -path "*/bin/java" | head -1)
482475

483476
if [ -n "$java_executable" ]; then

0 commit comments

Comments
 (0)