【问题标题】:Dependencies specified with `implementation` configuration in Gradle build not put into Spring Boot fat jar在 Gradle 构建中使用 `implementation` 配置指定的依赖项未放入 Spring Boot fat jar
【发布时间】:2020-04-16 09:21:46
【问题描述】:

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

  • 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 放入胖 jar 中。它没有!

【问题讨论】:

    标签: java spring spring-boot gradle


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2016-02-08
      • 2021-02-27
      • 2014-04-18
      • 2019-07-26
      • 1970-01-01
      • 2023-03-07
      • 2020-03-13
      • 2020-03-31
      • 2017-09-29
      相关资源
      最近更新 更多