【发布时间】:2020-09-05 15:59:34
【问题描述】:
我创建了一个 spring boot maven 项目并尝试使用插件将其转换为瘦 jar
<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.25.BUILD-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
它创建了一个薄罐子,但是当我尝试使用它运行它时
java -Dthin.root=. -Dthin.archive=. -jar target/thin-jar-poc-0.0.1-SNAPSHOT.jar
我遇到以下错误:
Cannot locate launcher: ./repository/org/springframework/boot/experimental/spring-boot-thin-launcher/1.0.25.BUILD-SNAPSHOT/spring-boot-thin-launcher-1.0.25.BUILD-SNAPSHOT-exec.jar
at org.springframework.boot.loader.wrapper.ThinJarWrapper.launch(ThinJarWrapper.java:131)
at org.springframework.boot.loader.wrapper.ThinJarWrapper.main(ThinJarWrapper.java:107)
我无法弄清楚原因。
【问题讨论】:
-
用maven-jar-plugin代替spring boot插件适合你吗?使用 maven-jar-plugin 和 maven-dependency-plugin 配置瘦 jar 可能要容易得多。
-
我将无法使用 maven-jar-plugin 和 maven-dependency-plugin,因为我正在尝试在 spring-boot-thin-layout 上进行 PoC
-
我遇到了同样的问题。你是怎么解决的?
标签: java spring spring-boot maven maven-plugin