Gradle Spring dependency-management Plugin: Difference between revisions
Jump to navigation
Jump to search
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
=External= | |||
* https://spring.io/blog/2015/02/23/better-dependency-management-for-gradle | |||
=Internal= | =Internal= | ||
Line 5: | Line 9: | ||
=Overview= | =Overview= | ||
Spring Framework uses [[Maven_Concepts_-_Dependencies#BOM|Maven BOM]]s to declare components whose version are related to each other. Gradle does not have built-in support for Maven BOMs, so we need to use plugins to manage them. "io.spring.dependency-management" is one of them. | |||
=Configuration= | |||
<syntaxhighlight lang='groovy'> | |||
buildscript { | |||
repositories { | |||
mavenCentral() | |||
} | |||
dependencies { | |||
classpath("io.spring.gradle:dependency-management-plugin:1.0.6.RELEASE") | |||
} | |||
} | |||
apply plugin: 'io.spring.dependency-management' | |||
repositories { | |||
mavenCentral() | |||
} | |||
dependencyManagement { | |||
imports { | |||
mavenBom 'io.spring.platform:platform-bom:Cairo-SR5' | |||
} | |||
} | |||
dependencies { | |||
implementation('org.springframework:spring-core') | |||
implementation('org.springframework:spring-context') | |||
implementation('org.springframework:spring-beans') | |||
} | |||
</syntaxhighlight> |
Latest revision as of 05:32, 2 December 2018
External
Internal
Overview
Spring Framework uses Maven BOMs to declare components whose version are related to each other. Gradle does not have built-in support for Maven BOMs, so we need to use plugins to manage them. "io.spring.dependency-management" is one of them.
Configuration
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("io.spring.gradle:dependency-management-plugin:1.0.6.RELEASE")
}
}
apply plugin: 'io.spring.dependency-management'
repositories {
mavenCentral()
}
dependencyManagement {
imports {
mavenBom 'io.spring.platform:platform-bom:Cairo-SR5'
}
}
dependencies {
implementation('org.springframework:spring-core')
implementation('org.springframework:spring-context')
implementation('org.springframework:spring-beans')
}