spring-boot gradle thin jar MavenCapsule

spring-boot gradle thin jar MavenCapsule

有没有替代MavenCapsule gradle 插件

我的 spring-boot 项目正在生成一个 >100MB 的可执行 fat jar,不方便传输到 QA 和生产。

基于 this 我创建了一个 test/sample spring-boot+ mavenCapsule 项目并且能够生成在执行期间下载(和缓存)依赖项的瘦 jar

但不适用于以下情况

CAPSULE: Transfer failed: capsule.org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact mysql:mysql-connector-java:pom:null in central (https://repo1.maven.org/maven2/)

检查你的 maven 版本,我在 maven 3.0.x 中遇到了类似的问题。它与 maven previos 到 3.1.x.

的以太版本有关

升级到 3.3.x 解决了这个问题。

这里有更多信息:https://github.com/chrisdchristo/capsule-maven-plugin/issues/4

备选方案:https://github.com/dsyer/spring-boot-thin-launcher

适用于示例项目,将在 real/big 项目中使用后更新。