java - 具有传递依赖关系的 Spring Boot Docker 层
问题描述
我有多个具有不同 3rd 方依赖项的微服务,目前使用默认的 spring boot docker 层,它将所有依赖项复制到相同的依赖项层。但是,我想将依赖项拆分为核心和依赖项层。核心层包含spring-boot-starter-webflux
,和其他依赖项spring-boot-starter-actuator
,spring-cloud-starter-sleuth
如 jpa、流等进入依赖项层。
bootJar {
enabled = true
archiveFileName = "${archiveBaseName.get()}.${archiveExtension.get()}"
layered {
application {
intoLayer("spring-boot-loader") {
include "org/springframework/boot/loader/**"
}
intoLayer("application")
}
dependencies {
intoLayer("application") {
includeProjectDependencies()
}
intoLayer("snapshot-dependencies") {
include "*:*:*SNAPSHOT"
}
intoLayer("core") {
include "org.springframework.boot:spring-boot-starter-webflux:*"
include "org.springframework:spring-webflux:*"
include "org.springframework.boot:spring-boot-starter-actuator:*"
}
intoLayer("dependencies")
}
layerOrder = ["core", "dependencies", "spring-boot-loader", "snapshot-dependencies", "application"]
}
}
这里的问题是分层包含不包括传递依赖。例如spring-webflux
不包括reactor
,netty
及物。我需要手动提及依赖项。有没有办法只包含对core
layer 的依赖关系,而不是对application
orsnapshot
和其余依赖关系的依赖关系dependencies
。
解决方案
推荐阅读
- android - 是否可以从 USB 摄像头流式传输视频和从移动麦克风流式传输音频以在 android 中进行 RTMP 流式传输
- azure - Azure 存储队列 - 异地冗余
- date - 在 XSD 中验证日期或日期时间的日期范围?
- scala - 如何映射所有元素都是类型类实例的 HList?
- azure - Azure 搜索架构迁移
- android - 支持 FreeFormWindow 的应用程序在角落启动
- excel - 如何从 pyspark 数据框中保存带有多张工作表的 excel 文件
- c++ - 如何将 std::array 元素附加或插入到 std::vector 中?
- python - Python - .insert() 方法只替换单词的第一个字母?
- sql - Google BigQuery SQL 是否有等待方法