简体   繁体   English

在 Gradle 构建中使用“实现”配置指定的依赖项未放入 Spring 引导胖 jar

[英]Dependencies specified with `implementation` configuration in Gradle build not put into Spring Boot fat jar

I'm working on some legacy code with the following versions:我正在使用以下版本处理一些遗留代码:

  • Gradle 4.10.2 Gradle 4.10.2
  • Spring Boot 1.5.16.RELEASE Spring 启动 1.5.16.RELEASE

I was expecting that any dependencies I specify with the implementation dependency configuration would be placed in the Spring Boot fat jar when I execute the assemble task.当我执行assemble任务时,我期望使用implementation依赖项配置指定的任何依赖项都将放在 Spring Boot fat jar 中。 However they are not .然而他们不是

I've resorted to using the deprecated compile dependency configuration for now, but I'm confused as to why implementation doesn't work.我现在已经使用了不推荐使用的compile依赖配置,但我对为什么implementation不起作用感到困惑。

Simplified build.gradle is as follows:简化的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'
}

In the example above, I would have expected commons-lang3-3.10.jar to be put inside the fat jar when I execute the assemble Gradle task.在上面的示例中,当我执行assemble Gradle 任务时,我希望将commons-lang3-3.10.jar放入胖 jar 中。 It does not!它不是!

The most likely explanation is that this version of the Spring boot plugin did not support the reworked configurations of the Gradle java plugins.最可能的解释是,这个版本的 Spring 引导插件不支持 Gradle java插件的重新设计配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM