首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >错误:原因: org.gradle.internal.component.external.model.DefaultModuleComponentSelector

错误:原因: org.gradle.internal.component.external.model.DefaultModuleComponentSelector
EN

Stack Overflow用户
提问于 2017-01-08 10:45:52
回答 1查看 3.6K关注 0票数 1

我的gradle.build

代码语言:javascript
复制
file for simple module is:
buildscript {
    ext {
        springBootVersion = '1.4.3.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'

jar {
    baseName = 'client-app'
    version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenCentral()
}


dependencies {
    compile('org.springframework.cloud:spring-cloud-starter-feign')
    // https://mvnrepository.com/artifact/com.netflix.hystrix/hystrix-core
    compile('org.springframework.cloud:spring-cloud-starter-hystrix')
    compile("org.springframework.boot:spring-boot-starter-web"){
        exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
    }
    compileOnly('org.projectlombok:lombok')
    testCompile('org.springframework.boot:spring-boot-starter-test')
}

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:Camden.BUILD-SNAPSHOT"
        mavenBom "org.springframework.boot:spring-boot-starter-parent:${springBootVersion}"
    }
}

在我关闭IDE (Intellij IDEA 2016)并重新打开之前,它一直运行良好。我得到的错误如下:

Error:Cause: org.gradle.internal.component.external.model.DefaultModuleComponentSelector

当我试图通过cmd运行时,我得到了下面的错误:

代码语言:javascript
复制
$ ./gradlew build
:client-app:compileJava
FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration 'detachedConfiguration2'.
> Could not resolve org.projectlombok:lombok:.
  Required by:
      hystrix-example:client-app:unspecified
   > Failed to resolve imported Maven boms: Could not find org.springframework.cloud:spring-cloud-dependencies:Camden.BUILD-SNAPSHOT.
     Searched in the following locations:
         https://repo1.maven.org/maven2/org/springframework/cloud/spring-cloud-dependencies/Camden.BUILD-SNAPSHOT/maven-metadata.xml
         https://repo1.maven.org/maven2/org/springframework/cloud/spring-cloud-dependencies/Camden.BUILD-SNAPSHOT/spring-cloud-dependencies-Camden.BUILD-SNAPSHOT.pom
         https://repo1.maven.org/maven2/org/springframework/cloud/spring-cloud-dependencies/Camden.BUILD-SNAPSHOT/spring-cloud-dependencies-Camden.BUILD-SNAPSHOT.pom
     Required by:
         hystrix-example:client-app:unspecified
> Could not find org.springframework.cloud:spring-cloud-starter-feign:.
  Searched in the following locations:
      https://repo1.maven.org/maven2/org/springframework/cloud/spring-cloud-starter-feign//spring-cloud-starter-feign-.pom
      https://repo1.maven.org/maven2/org/springframework/cloud/spring-cloud-starter-feign//spring-cloud-starter-feign-.jar
  Required by:
      hystrix-example:client-app:unspecified
> Could not find org.springframework.cloud:spring-cloud-starter-hystrix:.
  Searched in the following locations:
      https://repo1.maven.org/maven2/org/springframework/cloud/spring-cloud-starter-hystrix//spring-cloud-starter-hystrix-.pom
      https://repo1.maven.org/maven2/org/springframework/cloud/spring-cloud-starter-hystrix//spring-cloud-starter-hystrix-.jar
  Required by:
      hystrix-example:client-app:unspecified
> Could not find org.springframework.boot:spring-boot-starter-web:.
  Searched in the following locations:
      https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter-web//spring-boot-starter-web-.pom
      https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter-web//spring-boot-starter-web-.jar
  Required by:
      hystrix-example:client-app:unspecified

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.


BUILD FAILED

Total time: 9.571 secs

我想不出解决办法。

我已经尝试过gradle build --refresh-dependencies,但对我不起作用。提亚求救。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-01-11 21:01:08

最后,我在Issue #5564得到了解决方案。:)

正如@wilkinson在他关于这个问题的回复中提到的那样,项目依赖于Spring Boot的依赖项管理,版本解析失败。

因此,我显式地将版本指定为:

代码语言:javascript
复制
   dependencies {
    compile('org.springframework.cloud:spring-cloud-starter-feign:1.2.3.RELEASE')
    // https://mvnrepository.com/artifact/com.netflix.hystrix/hystrix-core
    compile('org.springframework.cloud:spring-cloud-starter-hystrix:1.2.3.RELEASE')
    compile("org.springframework.boot:spring-boot-starter-web:1.4.3.RELEASE"){
        exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
    }
    compileOnly('org.projectlombok:lombok:1.16.12')
    testCompile('org.springframework.boot:spring-boot-starter-test:1.4.3.RELEASE')
}

这对我很管用。:)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41528946

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档