How some gradle dependencies work without version

As far as I know, gradle requires a version number when setting up dependencies, but partial wildcards are allowed. For example, if I want Guava, I cannot do this because it fails:

compile('com.google.guava:guava')

It should be (as an example):

compile('com.google.guava:guava:21.0')

However, I am studying Spring, which has the following:

compile("org.springframework.boot:spring-boot-starter")
compile("org.springframework:spring-web")
compile("com.fasterxml.jackson.core:jackson-databind")

How do these dependencies work without version?

This is because of the following, but I thought that these lines are only needed for my plugin 'org.springframework.boot':

buildscript {
 repositories {
    mavenCentral()
 }
 dependencies {
    classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.3.RELEASE")
 }
}
+4
source share
3 answers

, ( ), spring -boot-depenedencies project. : http://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-build-systems.html

, Spring ( ), Spring BOM, .

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'io.spring.gradle:dependency-management-plugin:0.6.0.RELEASE'
    }
}

apply plugin: 'io.spring.dependency-management'

dependencyManagement {
    imports {
        mavenBom 'io.spring.platform:platform-bom:Athens-SR2'
    }
}
+5

TL; DR - spring boot .

A spring , :

apply plugin: 'spring-boot'

, . , , DependencyManagementPluginFeatures .

+6

spring boot gradle :

The version of the spring-boot-gradle plugin that you declare defines the version of spring-boot-starter-parent bom, which (this ensures that assemblies are always repeatable). You should always install the spring-boot gradle plugin version on the actual Spring Boot version that you want to use.

+3
source

Source: https://habr.com/ru/post/1666909/


All Articles