2017-01-08 3 views
1

gradle.build오류 : 원인 : org.gradle.internal.component.external.model.DefaultModuleComponentSelector

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를 통해 실행하려고 할 때, 나는 아래에 오류가있어 : 나는 해결책을 알아낼 수

$ ./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을 시도했지만 나에게 도움이되지 못했습니다. 도움을 받으려면 TIA.

답변

0

마지막으로 해결책은 Issue #5564입니다. :)

@wilkinson이 그 문제에 대한 그의 답변에서 언급했듯이 프로젝트는 Spring Boot의 의존성 관리에 의존하고 있으며 버전 확인에 실패하고 있습니다.

그래서, 명시 적으로 버전을 지정 :

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') 
} 

그리고 그것은 나를 위해 일했습니다. :)