carusyte
carusyte

Reputation: 1749

Alternatives to distribute spring-boot application using maven (other than spring-boot:repackage)

As far as I know, spring-boot-maven-plugin has already provided a way to distribute the entire application in a fat executable jar file: spring-boot-maven-plugin

However, sometimes we don't want a fat executable jar that encapsulates all the modules and dependencies and configuration files and such, maybe a zip/tar file with the main module in a jar and launch scripts for different platforms alongside the jar, and dependencies under the lib folder and configurations file reside in the conf folder:


    application.zip
        mainApp.jar
        run.sh
        run.bat
        lib
            a.jar
            b.jar
            c.jar
        conf
            application.properties
            logback.xml

How to make a distribution in this structure?

Upvotes: 3

Views: 1656

Answers (1)

Thorn G
Thorn G

Reputation: 12766

Use the Maven Appassembler plugin - their program example seems to be close to what you're looking for. The output will look something like:

.
`-- target
    `-- appassembler
        |-- bin
        |   |-- basic-test
        |   `-- basic-test.bat
        `-- repo
            `-- org
                `-- codehaus
                    `-- mojo
                        `-- appassembler-maven-plugin
                            `-- it
                                `-- platforms-test
                                    |-- 1.0-SNAPSHOT
                                    |   |-- maven-metadata-appassembler.xml
                                    |   `-- platforms-test-1.0-SNAPSHOT.jar
                                    `-- maven-metadata-appassembler.xml

Upvotes: 1

Related Questions