ext in buildscript can not be recognised by Gradle Kotlin DSL

前端 未结 5 1792
走了就别回头了
走了就别回头了 2021-01-31 07:39

In these days, I am trying to write some codes to experience the Spring reactive features and kotlin extension in Spring 5, and I also prepared a gradle Kotlin DSL build.gradle

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-31 08:27

    There is a new possibility with Kotlin we can use:

    object DependencyVersions {
        const val JETTY_VERSION = "9.4.12.v20180830"
    }
    
    dependencies{
        implementation("org.eclipse.jetty:jettyserver:${DependencyVersions.JETTY_VERSION}")
    }
    

    Here, DependencyVersions is a name I chose. You can choose another name, like "MyProjectVariables". This is a way to avoid using the extra or ext properties.

提交回复
热议问题