How can I force Gradle to set the same version for two dependencies?

前端 未结 8 1683
心在旅途
心在旅途 2020-11-29 18:11

I use the following two dependencies:

compile \'com.google.guava:guava:14.0.1\'
compile \'com.google.guava:guava-gwt:14.0.1\'

Both must be

8条回答
  •  醉梦人生
    2020-11-29 18:33

    Alternatively you can use dependencySets (or mavenBom when BOM POM is available) support in spring-dependency-management Gradle plugin. Note that this plugin is also automatically applied with spring-boot Gradle plugin. For more details see here.

    plugins {
      id 'io.spring.dependency-management' version '1.0.1.RELEASE'
    }
    
    dependencyManagement {
      dependencies {
        dependencySet(group: 'com.google.guava', version: '14.0.1') {
          entry 'guava'
          entry 'guava-gwt'
        }
      }
    }
    
    dependencies {
      compile 'com.google.guava:guava'
      compile 'com.google.guava:guava-gwt'
    }
    

提交回复
热议问题