我需要从类似于 org.springframework.boot.spring-boot-dependency 的 BOM 中获取类似“jackson.version”的属性。我知道我可以通过使用 dependencyManagement.importedProperties 来使用 io.spring.dependency-management 插件来做到这一点。但是 Gradle 的 5 Maven BOM 支持有什么方法可以实现这一点呢?
这是 io.spring.dependency-management(Kotlin DSL) 的示例:
dependencyManagement {
imports {
mavenBom("org.springframework.cloud:spring-cloud-dependencies:Greenwich.RELEASE")
}
}
dependencies {
implementation("org.group:artifact:${dependencyManagement.importedProperties["spring-cloud-aws.version"]}")
}
我想对 Gradle 5 做同样的事情:
dependencies {
implementation(platform("org.springframework.cloud:spring-cloud-dependencies:Greenwich.RELEASE}"))
implementation("org.group:artifact:${?["spring-cloud-aws.version"]}")
}
如何获取“spring-cloud-aws.version”(BOM 中的任何属性)?
最佳答案
目前没有。有许多功能尚不可用。您可以计划在更高版本的 Gradle 中实现它或更可能的等效功能。
请观看下面的详细视频,了解 Spring 依赖管理和 Gradle 5 对导入 BOM 的支持的比较:
Managing Dependencies for Spring Projects with Gradle by Jenn Strater and Andy Wilkinson
关于java - Gradle 5 中是否有 dependencyManagement.importedProperties 的替代品?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57389947/