When executing "mvn -P native native:compile" dependencies with scope provided are not considered. I couldn't find if this is actually the intended behavior or a bug, however, default configuration for non-native builds and jars works just fine with provided scopes.

Spring boot version: 3.0.5 maven version: 3.9.0 jdk: OpenJDK 64-Bit Server VM GraalVM CE 22.3.1 (build 17.0.6+10-jvmci-22.3-b13, mixed mode, sharing)

Steps to reproduce:

1 - Generate maven based project with native support with spring initializr 2 - run mvn -P native native:compile 3 - assert that the generated native binary runs successfully. 4 - manually changes scope of spring-boot-starter dependency to provided org.springframework.boot spring-boot-starter provided

5 - run mvn -P clean native native:compile - log will show warning messages "could not resolve <...> for reflection ..." 6 - generated binary will fail with message:

Exception in thread "main" java.lang.NoClassDefFoundError: org.springframework.boot.SpringApplication at com.example.demo.DemoApplication.main(DemoApplication.java:10)

Comment From: fernandosci

after some more tests I think the issue is actually in the graalvm native-maven-plugin. with scope provided mvn compile spring-boot:process-aot and then with scope compile (disabling process-aot) mvn native:compile produces a valid binary so the issue is probably not in process-aot

I will close this issue here and open in the native-build-tools