Packaging a Spring Boot application as Windows exe

I programmed once this handy tool to retrieve one-time passwords (too much insider knowledge for opensourcing it) and as soon as some teammates heard about it, they asked for a copy to spare them the zillion clicks the password generator needs. But… the tool existed only as a Maven project in my development environment 😦

It makes no sense to torture my dear business analyst mate with a maven installation, so I thought I’d package the JAR in a Windows EXE so it can be run at will. Launch4j is doing exactly that: you get a handy GUI tool (not exactly intuitive) which in the end creates an exe. Some great folks even created a Maven plugin for this Launch4j!

It’s just… every time I created the EXE from the GUI tool it worked, and every time I created it from Maven it failed.

I even saved the GUI configuration and reproduced it in Maven, to no avail. Then it came to me – I should need to specify the Spring Boot main class, not my application’s! And lo, it worked as a charm! Below is the proper Maven configuration, have fun 🙂




4 thoughts on “Packaging a Spring Boot application as Windows exe

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.