据我所知,spring-boot-maven-plugin已经提供了一种将整个应用程序分布在胖可执行jar文件中的方法: spring-boot-maven-plugin
但是,有时候我们不需要一个胖的可执行jar来封装所有的模块和依赖项和配置文件等等,也许是一个zip / tar文件,主模块在jar中,并且启动脚本以及jar的不同平台,以及依赖项在lib文件夹和配置文件下驻留在conf文件夹中:
application.zip mainApp.jar run.sh run.bat lib a.jar b.jar c.jar conf application.properties logback.xml如何在这个结构中进行分配?
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.xmlHow to make a distribution in this structure?
最满意答案
使用Maven Appassembler插件 - 他们的program示例似乎接近您正在寻找的内容。 输出看起来像:
. `-- 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.xmlUse 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更多推荐
发布评论