简体   繁体   English

使用gradle kotlin-dsl覆盖Spring Boot依赖项版本

[英]Override spring boot dependency version with gradle kotlin-dsl

SpringBoot comes with a lot of dependencies plus default versions for them. SpringBoot带有很多依赖项以及它们的默认版本。 In groovy-gradle, such dependency versions can be overridden with: 在groovy-gradle中,可以使用以下方式覆盖此类依赖项版本:

ext['mockito.version'] = '1.7.5'

But this doesn't work for the kotlin-dsl. 但这不适用于kotlin-dsl。 I tried: 我试过了:

val mockito by extra { "2.12.0" }
val mockito.version by extra { "2.12.0" }
val `mockito.version` by extra { "2.12.0" }

The latter two, don't compile, the first one, isn't doing the job. 后两个,不编译,第一个,不执行任务。

How can the version be overridden within the kotlin file (I don't want to create a separate properties file if it is somehow possible). 如何在kotlin文件中覆盖该版本(如果可以的话,我不想创建一个单独的属性文件)。

尝试extra["mockito.version"] = "1.7.5"

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

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