Skip to content

Broken command discovery in GraalVM native binary #1229

@fmbenhassine

Description

@fmbenhassine

After fixing native runtime hints in 891a148, the native compilation now passes but the user's defined commands are not discovered correctly. Here is a minimal complete app to use with GraalVM 25+ and the snapshots of Spring Shell v4 at 891a148 or later:

spring-shell-sample-spring-boot.zip

The following instructions can be found in the README of the attached minimal project:

$>sdk install java 25.0.1-graalce
$>sdk use java 25.0.1-graalce
$>java -version
openjdk version "25.0.1" 2025-10-21
OpenJDK Runtime Environment GraalVM CE 25.0.1+8.1 (build 25.0.1+8-jvmci-b01)
OpenJDK 64-Bit Server VM GraalVM CE 25.0.1+8.1 (build 25.0.1+8-jvmci-b01, mixed mode, sharing)
$>./mvnw clean install
$>./mvnw -Pnative native:compile

Once the native build is complete, run the native executable located in the target directory and see how the hello command does not show up:

$>./target/spring-shell-sample-spring-boot

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::                (v4.0.1)

[...]

06:35:21.547 [main] INFO  o.s.s.s.h.b.SpringShellApplication - Started SpringShellApplication in 0.273 seconds (process running for 0.298)
shell:>help
06:35:26.760 [main] INFO  o.h.validator.internal.util.Version - HV000001: Hibernate Validator 9.0.1.Final
Available commands:
Built-In Commands
	clear: Clear the terminal screen
	help: Display help about available commands
	version: Show version info
	script: Execute commands from a script file

shell:>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions