我正在处理以下版本的一些遗留代码:
- 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/