您可能要考虑使用Spring Boot Thin Launcher。它使用您的应用程序代码创建一个jar文件,但没有依赖项。它添加了一个特殊的瘦启动器,该启动器知道执行jar时如何从远程Maven存储库或本地缓存中解决应用程序的依赖性。通过对要执行的操作的描述来判断,您将利用本地缓存选项。
Spring Boot的Maven插件的配置,以生成使用瘦启动器的完全可执行的jar,如下所示:
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <dependencies> <dependency> <groupId>org.springframework.boot.experimental</groupId> <artifactId>spring-boot-thin-layout</artifactId> <version>1.0.3.RELEASE</version> </dependency> </dependencies> <configuration> <executable>true</executable> </configuration> </plugin> </plugins></build>



