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

前端 未结 8 1911
心在旅途
心在旅途 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:29

    On gradle v6.1.1, the simplest is:

    dependencies {
        def jerseyVersion = '2.29.1'
        compile group: 'org.glassfish.jersey.core', name: 'jersey-client', version: jerseyVersion
    
        // ...
    }
    
    0 讨论(0)
  • 2020-12-25 10:35

    You can use now even more close to the dependencies in the App Gradle Build as shown below:

    dependencies {
        def daggerVersion = "2.24"
        implementation "com.google.dagger:dagger:$daggerVersion"
        annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
    }
    
    0 讨论(0)
提交回复
热议问题