Gradle 渐变弹簧引导力依赖性

Gradle 渐变弹簧引导力依赖性,gradle,Gradle,我使用的是SpringBootGradle插件2.0.0.M3,我希望在最终的jar中包含spring数据elasticsearch:3.0.0.RC2 下面是我的身材 buildscript { ext { springBootVersion = '2.0.0.M3' } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${sprin

我使用的是SpringBootGradle插件2.0.0.M3,我希望在最终的jar中包含spring数据elasticsearch:3.0.0.RC2

下面是我的身材

buildscript {
    ext {
        springBootVersion = '2.0.0.M3'
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

plugins {
    id "io.spring.dependency-management" version "1.0.3.RELEASE"
}

apply plugin: 'org.springframework.boot'
apply plugin: 'maven-publish'
apply plugin: 'java'

dependencyManagement {
    imports {
        mavenBom 'org.springframework.cloud:spring-cloud-starter-parent:Finchley.M2'
    }
}

group='mygroup'
version='1.0.0'


configurations.all {
    exclude group: 'javax.servlet.jsp', module: 'jsp-api'
    exclude group: 'org.mortbay.jetty'

    resolutionStrategy {
        force("org.springframework.data:spring-data-elasticsearch:3.0.0.RC2")
    }

}
但武力解决方案不起作用。拉取spring-data-elasticsearch-3.0.0.RC2,而不是spring-data-elasticsearch-3.0.0.M4

下面是依赖项的详细信息

org.springframework.data:spring数据弹性搜索:3.0.0.RC2->3.0.0.M4


强制解析在Spring boot中不起作用吗?

如果以通常的方式提到依赖项,则强制解析会起作用

configurations.all {

    resolutionStrategy {
        force("org.springframework.data:spring-data-elasticsearch:3.0.0.RC2")
    }

}

dependencies {

    compile("org.springframework.boot:spring-boot-starter-data-jpa")

    compile "org.springframework.data:spring-data-elasticsearch:3.0.0.RC2"
}

ResolutionsStrategy似乎被忽略了——SpringBoot的依赖项解析在您的案例中正确地处理了编译依赖项,但前5行在您的案例中没有做任何事情。在我的例子中,我不想直接指定依赖项,我只想覆盖版本。