DEV Community

özkan pakdil
özkan pakdil

Posted on • Originally published at ozkanpakdil.github.io on

How to build spring boot native binary

In short, I am explaining why we should use ./mvnw -Pnative native:compile and what error comes otherwise and why.

I was preparing this answer. And I was having problem with the class not found errors while building because I was using this command

./mvnw native:compile
...
Error: Please specify class (or <module>/<mainclass>) containing the main entry point method. (see --help)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.448 s
[INFO] Finished at: 2024-09-01T21:24:32+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.graalvm.buildtools:native-maven-plugin:0.10.2:compile (default-cli) on project env-variables: Execution of C:\sdkman\candidates\java\21.0.2-graal\bin\native-image.cmd @target\tmp\native-image-2373453772169200185.args returned non-zero result -> [Help 1]
[ERROR]

Enter fullscreen mode Exit fullscreen mode

Then remembered the profile thing and finally get rid of this error, used below command

./mvnw -Pnative native:compile

Enter fullscreen mode Exit fullscreen mode

that actually trigger spring-boot:process-aot that creates the required configuration for graalvm to build the project for native binary. Check this page for details.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more