Search code examples
javamavenspring-boot-maven-plugin

Spring Boot Maven plugin - How do I build a zip file with Java jar file and script to run it?


I have a simple Spring Boot Java application and am building it using the spring-boot-maven-plugin repackage goal.

I want to be able to package up the application, its dependencies and a script file that will be used to run the Java application, into a zip file. The script will be a Windows batch (.bat) script.

Does the plugin support this? I briefly looked at the plugin documentation, but couldn't find anything.

If this plugin is not able to do this, or if there is a better alternative, please let me know. I've worked with Maven in the past, but am a little rusty.


Solution

  • The spring-boot-maven-plugin is not capable of doing that.

    But you can combine and using the maven-assembly-plugin to create the zip archive and creating a script like start.cmd (I would suggest to use .cmd instead .bat)