最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Gradle

旗下网站admin15浏览0评论

Gradle

Gradle

Gradle - 无法追踪传递依赖(Gradle - unable to track down transitive dependency)

我有两个模块:common和domain。 域是共同的依赖。 在域中,我正在尝试添加最新版本的Spring Data Elasticsearch,但它一直在恢复旧版本。 我的域的build.gradle文件如下所示:

domain build.gradle

apply plugin: 'spring-boot'buildscript {repositories { mavenCentral()}dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE")}}dependencies {compile("org.springframework.boot:spring-boot-starter-data-jpa")compile("org.springframework.boot:spring-boot-starter-redis")compile("org.springframework.data:spring-data-elasticsearch:2.0.1.RELEASE")compile 'org.slf4j:slf4j-api'compile 'com.google.guava:guava:19.0'compile 'com.google.code.gson:gson:2.4'testCompile "org.mockito:mockito-core:1.+"}

这里的elasticsearch版本是2.0.1.RELASE但是,如果我共同运行dependencyInsight,它将检索1.3.4.RELEASE:

gradle dependencyInsight --dependency elasticsearch --configuration compile:common:dependencyInsightDownload .3.4.RELEASE/spring-data-elasticsearch-1.3.4.RELEASE.pomorg.elasticsearch:elasticsearch:1.5.2 (selected by rule) \--- org.springframework.data:spring-data-elasticsearch:1.3.4.RELEASE \--- project :domain \--- compileorg.springframework.data:spring-data-elasticsearch:1.3.4.RELEASE (selected by rule)org.springframework.data:spring-data-elasticsearch:2.0.1.RELEASE -> 1.3.4.RELEASE\--- project :domain \--- compile

common build.gradle

apply plugin: 'spring-boot'buildscript {repositories { mavenCentral()}dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE")}} dependencies {compile project(':domain')compile 'com.google.code.gson:gson:2.4'compile 'org.owasp.encoder:encoder:1.2'compile 'com.ning:async-http-client:1.9.31'compile 'org.slf4j:slf4j-api'compile 'org.springframework.security:spring-security-core'compile 'org.springframework.security:spring-security-acl:4.0.3.RELEASE'compile 'javax.mail:javax.mail-api:1.5.4'compile 'com.sun.mail:javax.mail:1.5.4'testCompile group: 'junit', name: 'junit', version: '4.12'testCompile "org.mockito:mockito-core:1.+"}

是否有原因导致版本1.3.4.RELEASE正在替换2.0.1.RELEASE?

I have two modules: common and domain. Domain is a dependency of common. In domain, I'm trying to add the latest version of Spring Data Elasticsearch but it keeps reverting back to an old version. My domain's build.gradle file looks like this:

domain build.gradle

apply plugin: 'spring-boot'buildscript {repositories { mavenCentral()}dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE")}}dependencies {compile("org.springframework.boot:spring-boot-starter-data-jpa")compile("org.springframework.boot:spring-boot-starter-redis")compile("org.springframework.data:spring-data-elasticsearch:2.0.1.RELEASE")compile 'org.slf4j:slf4j-api'compile 'com.google.guava:guava:19.0'compile 'com.google.code.gson:gson:2.4'testCompile "org.mockito:mockito-core:1.+"}

The version for elasticsearch here is 2.0.1.RELASE However, if I run dependencyInsight in common, it is retrieving 1.3.4.RELEASE instead:

gradle dependencyInsight --dependency elasticsearch --configuration compile:common:dependencyInsightDownload .3.4.RELEASE/spring-data-elasticsearch-1.3.4.RELEASE.pomorg.elasticsearch:elasticsearch:1.5.2 (selected by rule) \--- org.springframework.data:spring-data-elasticsearch:1.3.4.RELEASE \--- project :domain \--- compileorg.springframework.data:spring-data-elasticsearch:1.3.4.RELEASE (selected by rule)org.springframework.data:spring-data-elasticsearch:2.0.1.RELEASE -> 1.3.4.RELEASE\--- project :domain \--- compile

common build.gradle

apply plugin: 'spring-boot'buildscript {repositories { mavenCentral()}dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE")}} dependencies {compile project(':domain')compile 'com.google.code.gson:gson:2.4'compile 'org.owasp.encoder:encoder:1.2'compile 'com.ning:async-http-client:1.9.31'compile 'org.slf4j:slf4j-api'compile 'org.springframework.security:spring-security-core'compile 'org.springframework.security:spring-security-acl:4.0.3.RELEASE'compile 'javax.mail:javax.mail-api:1.5.4'compile 'com.sun.mail:javax.mail:1.5.4'testCompile group: 'junit', name: 'junit', version: '4.12'testCompile "org.mockito:mockito-core:1.+"}

Is there a reason why version 1.3.4.RELEASE is replacing 2.0.1.RELEASE?

最满意答案

您正在将Spring Boot的Gradle插件应用于您的公共项目。 这意味着它的依赖关系管理将控制项目依赖项的版本。 要获得所需的Spring Data Elasticsearch版本,可以通过添加以下内容来覆盖Boot的依赖关系管理:

dependencyManagement { dependencies { dependency 'org.springframework.data:spring-data-elasticsearch:2.0.1.RELEASE' }}

You're applying Spring Boot's Gradle plugin to your common project. That means that its dependency management will be controlling the versions of the project's dependencies. To get the version of Spring Data Elasticsearch that you want, you can override Boot's dependency management by adding the following:

dependencyManagement { dependencies { dependency 'org.springframework.data:spring-data-elasticsearch:2.0.1.RELEASE' }}

发布评论

评论列表(0)

  1. 暂无评论