alina-yur/native-spring-boot

Demo won't start

Closed this issue · 3 comments

Thanks for the demo, just a couple things.

I'm trying to run mvn -Pinstrumented native:compile and -Poptimized but getting the following error:

Error: Please specify class (or /) containing the main entry point method. (see --help)

When I add com.example.demo.DemoApplication to the instrumented and or optimized plugin configuration it builds but when I run target/demo-instrumented it just shows the spring-boot startup message then terminates.

mvn -Pnative native:compile works without having to specify the mainClass.

Any ideas? I'm I missing something?

Environment:
java version "21.0.2" 2024-01-16 LTS
Java(TM) SE Runtime Environment Oracle GraalVM 21.0.2+13.1 (build 21.0.2+13-LTS-jvmci-23.1-b30)
Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 21.0.2+13.1 (build 21.0.2+13-LTS-jvmci-23.1-b30, mixed mode, sharing)

Thanks,

Hi @bwburch, thank you for feedback. I hit it sometimes as well, and the way I work around it is by doing the following step before invoking -Pinstrumented/ -Poptimized:

mvn clean compile spring-boot:process-aot package

I suspect that the profiles since they are custom don't trigger the Spring AOT step, but I haven't found yet a civilized way to avoid this issue.

Perfect, thank you for the guidance. I will give this a try!

@bwburch, if this is still relevant for you, seems like there's a better way to avoid this issue by triggering instrumented/optimized profiles with the native one:

mvn package -Pnative,instrumented native:compile
mvn package -Pnative,optimized native:compile

I think this can be further optimized, but it works.