ci: auto-answer SDKMAN prompts so multi-JDK install completes #4
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # TEMPORARY — diagnostic reproduction for issue #18 (macOS + SDKMAN JRE not resolved). | |
| # Manually triggered only. DELETE this file once the root cause is confirmed and fixed. | |
| name: Repro issue 18 (macOS + SDKMAN) | |
| on: | |
| push: | |
| branches: | |
| - repro/issue-18 | |
| jobs: | |
| repro: | |
| # arm64 runner — matches the reporter's aarch64 Mac. | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # Temurin is only used to RUN the Maven build. The JavaLens product itself | |
| # is later launched under a SDKMAN-managed Corretto JVM (the reporter's setup). | |
| - name: Set up build JDK 21 (Temurin) | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Install Maven, coreutils (gtimeout), and modern bash (SDKMAN needs Bash 4+) | |
| run: brew install maven coreutils bash | |
| - name: Build product (skip tests) | |
| run: ./mvnw clean package -DskipTests -q | |
| - name: Install SDKMAN + Corretto 21 (reporter's JVM) | |
| # macOS runners default to Bash 3.2; SDKMAN requires Bash 4+, so run under brew bash. | |
| shell: /opt/homebrew/bin/bash -e {0} | |
| run: | | |
| curl -s "https://get.sdkman.io" | /opt/homebrew/bin/bash | |
| export sdkman_auto_answer=true | |
| source "$HOME/.sdkman/bin/sdkman-init.sh" | |
| # Match the reporter's full set of installed JDKs (his .install.xml lists all four). | |
| # Java 8 has a pre-module rt.jar layout — its presence changes JDT's VM reconciliation. | |
| sdk install java 8.0.432-amzn | |
| sdk install java 11.0.28-amzn | |
| sdk install java 17.0.14-amzn | |
| sdk install java 21.0.5-amzn | |
| ls -la "$HOME/.sdkman/candidates/java/" | |
| - name: Create a minimal Maven project that references java.* types | |
| run: | | |
| mkdir -p /tmp/proj/src/main/java/com/example | |
| cat > /tmp/proj/pom.xml <<'EOF' | |
| <project xmlns="http://maven.apache.org/POM/4.0.0"> | |
| <modelVersion>4.0.0</modelVersion> | |
| <groupId>com.example</groupId> | |
| <artifactId>repro</artifactId> | |
| <version>1.0</version> | |
| <properties> | |
| <maven.compiler.release>21</maven.compiler.release> | |
| </properties> | |
| </project> | |
| EOF | |
| cat > /tmp/proj/src/main/java/com/example/Demo.java <<'EOF' | |
| package com.example; | |
| import java.util.Map; | |
| public class Demo { | |
| private Map<String, String> config; | |
| public String describe() throws Exception { | |
| return config == null ? "empty" : config.toString(); | |
| } | |
| } | |
| EOF | |
| - name: Launch JavaLens under SDKMAN Corretto and probe JRE resolution | |
| run: | | |
| SDK_JAVA="$HOME/.sdkman/candidates/java/21.0.5-amzn/bin/java" | |
| echo "=== running JVM java.home ===" | |
| "$SDK_JAVA" -XshowSettings:properties -version 2>&1 | grep -E "java.home|java.vendor" || true | |
| ECL="org.javalens.product/target/products/org.javalens.product/macosx/cocoa/aarch64/JavaLens.app/Contents/Eclipse" | |
| echo "=== product Eclipse dir ===" | |
| ls -la "$ECL" | |
| REQ='{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"repro","version":"1"}}} | |
| {"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"load_project","arguments":{"projectPath":"/tmp/proj"}}} | |
| {"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"get_classpath_info","arguments":{}}} | |
| {"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"get_diagnostics","arguments":{"filePath":"/tmp/proj/src/main/java/com/example/Demo.java"}}}' | |
| echo "=== launching product (java.home = SDKMAN Corretto) ===" | |
| OUT=$(printf '%s\n' "$REQ" | gtimeout 180 "$SDK_JAVA" \ | |
| -Xmx512m \ | |
| -Dosgi.bundles.defaultStartLevel=4 \ | |
| --add-modules=ALL-SYSTEM \ | |
| --add-opens=java.base/java.lang=ALL-UNNAMED \ | |
| --add-opens=java.base/java.util=ALL-UNNAMED \ | |
| -jar "$ECL/javalens.jar" -data /tmp/ws 2>/tmp/err.log || true) | |
| echo "=== stderr ===" | |
| cat /tmp/err.log || true | |
| echo "=== stdout (MCP responses) ===" | |
| echo "$OUT" | |
| echo "=== verdict ===" | |
| if echo "$OUT" | grep -q 'java.lang.Object cannot be resolved'; then | |
| echo "REPRODUCED: BUILDPATH cascade present — JRE container has no IVMInstall backing it." | |
| exit 1 | |
| fi | |
| if echo "$OUT" | grep -q '"systemModules":\[\]'; then | |
| echo "REPRODUCED: jre.systemModules is empty — getVMInstall(project) returned null." | |
| exit 1 | |
| fi | |
| echo "NOT reproduced on this runner — jre resolved cleanly." |