简体   繁体   中英

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
  • Spring Boot 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. 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.

Simplified build.gradle is as follows:

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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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