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

对着背影说爱祢 提交于 2019-12-11 11:47:21

问题


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?


回答1:


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


来源:https://stackoverflow.com/questions/35061619/alternatives-to-distribute-spring-boot-application-using-maven-other-than-sprin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!