How do I define a variable for the dependency version in Gradle

前端 未结 8 1989
心在旅途
心在旅途 2020-12-25 10:00

I am currently trying to migrate a Maven project to Gradle

In my Maven version I have the dependency versions all listed out l

8条回答
  •  心在旅途
    2020-12-25 10:13

    the version-value-variable works only in double quotes.

    Below implementation doesn't work with single quotes.

    ext {
       springBootVersion = '2.2.7.RELEASE'
    }
    dependencies {
       implementation 'org.springframework.boot:spring-boot-starter-web:$springBootVersion'
    }
    

    Below one works with double quotes:->

    ext {
        springBootVersion = '2.2.7.RELEASE'
    }
    dependencies {
        implementation "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
    }
    

    So, now I have to convert all single quotes to double quotes. Can someone help me to make version-value-variable work with single quotes?

提交回复
热议问题