java - Gradle 构建中使用 `implementation` 配置指定的依赖项未放入 Spring Boot fat jar 中

标签 java spring spring-boot gradle

我正在处理以下版本的一些遗留代码:

  • Gradle 4.10.2
  • Spring Boot 1.5.16.RELEASE

我期望当我执行 assemble 任务时,我使用 implementation 依赖项配置指定的任何依赖项都会被放置在 Spring Boot fat jar 中。然而它们不是

我现在已经求助于使用已弃用的 compile 依赖项配置,但我很困惑为什么 implementation 不起作用。

简化的build.gradle如下:

plugins {
    id 'java'
    id "org.springframework.boot" version "1.5.16.RELEASE"
}

group 'org.example'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
    mavenLocal()
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'

    implementation 'org.apache.commons:commons-lang3:3.10'

    testCompile group: 'junit', name: 'junit', version: '4.12'
}

在上面的示例中,当我执行 assemble Gradle 任务时,我希望将 commons-lang3-3.10.jar 放入 fat jar 中。事实并非如此!

最佳答案

最可能的解释是这个版本的 Spring boot 插件不支持 Gradle java 插件的重新配置。

关于java - Gradle 构建中使用 `implementation` 配置指定的依赖项未放入 Spring Boot fat jar 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61246809/

相关文章:

spring-boot - 实体类名转换为带下划线的SQL表名

java - Spring 启动 MVC。传递空请求正文

java - 扫描仪只读取第一个字而不是行

带有 REST 的 Java Web 服务架构

spring-boot - 估计异常是 javax.management.InstanceAlreadyExistsException : com. zaxxer.hikari :name=dataSource, type=HikariDataSource

spring - 如何将Spring Boot RESTful Web服务Docker镜像部署到EC2?

java - Hibernate session 问题,新线程从 Grails Controller 启动

java - Android recyclerview 在 fragment 中不起作用

java - Apache ignite 关于 setStoreKeepBinary 和 setBackups 的缓存配置

java - Spring HATEOAS 模板链接无效下载方法