Gradle里面两个 依赖管理插件,可以不用关心 具体jar版本号

Posted 张利锋

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Gradle里面两个 依赖管理插件,可以不用关心 具体jar版本号相关的知识,希望对你有一定的参考价值。

引用:https://spring.io/blog/2015/02/23/better-dependency-management-for-gradle

Using the plugin with Spring Boot

There are some similarities between this plugin and Spring Boot’s Gradle plugin. For example, the Spring Boot plugin also allows dependencies to be declared without a version, however it doesn’t affect transitive dependencies and doesn’t honor Maven exclusions.

In the forthcoming Spring Boot 1.3 we have removed Boot’s own dependency management and started using the dependency management plugin instead. For users of earlier versions of Spring Boot, the two plugins will happily co-exist and you can configure the dependency management plugin to use Spring Boot’s starter bom:

 

buildscript {
  repositories {
    jcenter()
  }
  dependencies {
    classpath "io.spring.gradle:dependency-management-plugin:0.5.1.RELEASE"
    classpath "org.springframework.boot:spring-boot-gradle-plugin:1.2.3.RELEASE"
  }
}

apply plugin: "io.spring.dependency-management"
apply plugin: "spring-boot"

repositories {
  jcenter()
}

dependencyManagement {
  imports {
    mavenBom org.springframework.boot:spring-boot-starter-parent:1.2.1.RELEASE
  }
}

dependencies {
  compile "org.springframework.boot:spring-boot-starter-web"
}

 

以上是关于Gradle里面两个 依赖管理插件,可以不用关心 具体jar版本号的主要内容,如果未能解决你的问题,请参考以下文章

Android Gradle 插件Gradle 依赖管理 ③ ( build.gradle#dependencies 依赖分组 | configurations 自定义依赖分组 )

Android Gradle 插件Gradle 依赖管理 ② ( build.gradle 中的 dependencies 依赖配置 | DependencyHandler#add 方法介绍 )

从 Spring 依赖管理获取 Hibernate 版本以在 Gradle 中配置插件

Android Gradle 插件Gradle 依赖管理 ④ ( Android Gradle 插件中注册的依赖分组 | implementation | api | compileOnly )

Android Gradle 插件Gradle 依赖管理 ① ( org.gradle.api.Project 配置 | Android Gradle 插件配置与 Gradle 配置关联 ) ★

Android Gradle 插件Gradle 依赖管理 ⑩ ( dependencies 依赖配置项 configurations )