首页 > 解决方案 > Spring Boot 'bootJar' 任务不构建胖 jar,而是排除 .original

问题描述

bubbleshadow% ls -l build/libs
total 83544
-rw-r--r--  1 dlynch  staff  42772394 May 14 08:37 bubbleshadow-0.0.1-SNAPSHOT.jar

运行上面的 .jar 文件(应该是一个胖 jar)时,我收到以下错误:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path res
ource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException 

我试图按照以下说明进行操作: https ://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/html/

在 8.1 中,它对 Java 插件说反应(原文如此):

接着:

创建一个名为 bootJar 的 BootJar 任务,该任务将为项目创建一个可执行(原文如此)的 fat jar。

我的构建在 IntelliJ IDEA 中运行,但在命令行上执行时不运行。

根据 Josh Long 的 Book Learning Spring Boot 2.0 - Second Edition,看到它说:

If we peek at the output, we'll find the original JAR file (non-FAT) along with the rebundled one containing our application code as well as the third-party dependencies, as shown here: $ ls build/libs
learning-spring-boot-0.0.1-SNAPSHOT.jar
learning-spring-boot-0.0.1-SNAPSHOT.jar.original

Turnquist, Greg L.. 学习 Spring Boot 2.0 - 第二版:简化基于微服务和响应式编程的闪电般快速应用程序的开发(Kindle Locations 664-667 ( sic ))。包出版。Kindle版。

我不明白为什么没有生产 .original jar 并且它为我生产的 jar 无法运行。

标签: spring-boot

解决方案


推荐阅读