使用maven分发spring-boot应用程序的替代方法(spring-boot:repackage除外) [英] Alternatives to distribute spring-boot application using maven (other than spring-boot:repackage)
问题描述
据我所知,spring-boot-maven-plugin已经提供了一种将整个应用程序分发到胖可执行jar文件中的方法:
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
但是,有时我们不想要一个胖的可执行jar,它封装了所有模块,依赖项和配置文件,例如,可能是一个zip/tar文件,其中的主要模块位于jar中,并在jar旁边启动了针对不同平台的脚本,并且lib文件夹和配置文件下的依赖项位于conf文件夹中:
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?
推荐答案
使用Maven Appassembler插件-他们的program
示例似乎与您想要的很接近.输出将类似于:
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
这篇关于使用maven分发spring-boot应用程序的替代方法(spring-boot:repackage除外)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!