2016-06-12 12 views
1

私はSpring Bootアプリケーションを数ヶ月にわたって正常に実行していました。私はSpring Boot 1.4.0-BUILD-SNAPSHOTをいくつかの非常に基本的な依存関係で使用していました。ここに私のbuild.gradleが見えた方法です:Spring Maven RepoとSpring Boot 1.4.xの潜在的な問題

buildscript { 
    ext { 
     springBootVersion = '1.4.0.BUILD-SNAPSHOT' 
    } 
    repositories { 
     mavenCentral() 
     maven { url "https://repo.spring.io/snapshot" } 
     maven { url "https://repo.spring.io/milestone" } 
    } 
    dependencies { 
     classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 
    } 
} 

apply plugin: 'java' 
apply plugin: 'eclipse' 
apply plugin: 'spring-boot' 

jar { 
    baseName = 'test' 
    version = '0.0.1-SNAPSHOT' 
} 

sourceCompatibility = 1.8 
targetCompatibility = 1.8 

repositories { 
    mavenCentral() 
    maven { url "https://repo.spring.io/snapshot" } 
    maven { url "https://repo.spring.io/milestone" } 
} 

dependencies { 
    compile('org.springframework.boot:spring-boot-starter-actuator') 
    compile('org.springframework.cloud:spring-cloud-starter-eureka') 
    compile('org.springframework.cloud:spring-cloud-starter-ribbon') 
    compile('org.springframework.boot:spring-boot-starter-web') 
    testCompile('org.springframework.boot:spring-boot-starter-test') 
} 

dependencyManagement { 
    imports { 
     mavenBom "org.springframework.cloud:spring-cloud-dependencies:Brixton.BUILD-SNAPSHOT" 
    } 
} 

eclipse { 
    classpath { 
     containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER') 
     containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8' 
    } 
} 

task wrapper(type: Wrapper) { 
    gradleVersion = '2.13' 
} 

これは2016年6月11日(昨日の夜)まで、何の問題もなく働きました。私は私のGradleは、以下のコマンドを使用してビルドを実行することができ、すべてがうまく働い:以下に示すように

$ ./gradlew clean build 

はしかし、どこからともなく私のGradleはエラーで動作を停止ビルド:

$ ./gradlew build 
:compileJava 

FAILURE: Build failed with an exception. 

* What went wrong: 
Could not resolve all dependencies for configuration ':compileClasspath'. 
> Could not resolve org.springframework.boot:spring-boot-starter-actuator:. 
    Required by: 
     :test:unspecified 
    > Failed to resolve imported Maven boms: Cannot change dependencies of configuration 'detachedConfiguration1' after it has been resolved. 
> Could not resolve org.springframework.cloud:spring-cloud-starter-eureka:. 
    Required by: 
     :test:unspecified 
    > Failed to resolve imported Maven boms: Cannot change dependencies of configuration 'detachedConfiguration1' after it has been resolved. 
> Could not resolve org.springframework.cloud:spring-cloud-starter-ribbon:. 
    Required by: 
     :test:unspecified 
    > Failed to resolve imported Maven boms: Cannot change dependencies of configuration 'detachedConfiguration1' after it has been resolved. 
> Could not resolve org.springframework.boot:spring-boot-starter-web:. 
    Required by: 
     :test:unspecified 
    > Failed to resolve imported Maven boms: Cannot change dependencies of configuration 'detachedConfiguration1' after it has been resolved. 

* 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: 4.846 secs 

私が実行してみました​​を使用して、依存関係のエラーを確認してください。

$ ./gradlew dependencies 
... (snipped) 
compile - Dependencies for source set 'main'. 
Download https://repo.spring.io/snapshot/org/springframework/boot/spring-boot-starter-parent/1.4.0.BUILD-SNAPSHOT/spring-boot-starter-parent-1.4.0.BUILD-20160612.070708-419.pom 
Download https://repo.spring.io/snapshot/org/springframework/cloud/spring-cloud-dependencies/Brixton.BUILD-SNAPSHOT/spring-cloud-dependencies-Brixton.BUILD-20160610.161057-28.pom 
Download https://repo.spring.io/snapshot/org/springframework/cloud/spring-cloud-dependencies-parent/1.1.2.BUILD-SNAPSHOT/spring-cloud-dependencies-parent-1.1.2.BUILD-20160612.192124-248.pom 
Download https://repo.spring.io/snapshot/org/springframework/cloud/spring-cloud-netflix-dependencies/1.1.3.BUILD-SNAPSHOT/spring-cloud-netflix-dependencies-1.1.3.BUILD-20160610.160842-2.pom 
+--- org.springframework.boot:spring-boot-starter-actuator: FAILED 
+--- org.springframework.cloud:spring-cloud-starter-eureka: FAILED 
+--- org.springframework.cloud:spring-cloud-starter-ribbon: FAILED 
\--- org.springframework.boot:spring-boot-starter-web: FAILED 

compileClasspath - Compile classpath for source set 'main'. 
+--- org.springframework.boot:spring-boot-starter-actuator: FAILED 
+--- org.springframework.cloud:spring-cloud-starter-eureka: FAILED 
+--- org.springframework.cloud:spring-cloud-starter-ribbon: FAILED 
\--- org.springframework.boot:spring-boot-starter-web: FAILED 

... (same messages repeating for all tasks) 

BUILD SUCCESSFUL 

Total time: 35.879 secs 

いくつかのより多くの調査の後、私は(;同じ問題私もhttpとURLを試してみました)依存関係がrepo.spring.io/snapshotまたはrepo.spring.io/milestoneからダウンロードすることができなかったことが判明:これは私が見つけたものです。他の問題を除外するために、repo.spring.io/releasehttpshttp)と一緒に試してみましたが、これはまったく同じ問題です。

この問題を回避するために、Springブートバージョンを1.3.5.RELEASEにダウングレードしました(SpringのMavenリポジトリに移動せずにMaven Centralリポジトリから利用可能でした)。更新されたbuild.gradleは次のようになります。

buildscript { 
    ext { 
     springBootVersion = '1.3.5.RELEASE' 
    } 
    repositories { 
     mavenCentral() 
    } 
    dependencies { 
     classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 
    } 
} 

apply plugin: 'java' 
apply plugin: 'eclipse' 
apply plugin: 'spring-boot' 

jar { 
    baseName = 'test' 
    version = '0.0.1-SNAPSHOT' 
} 

sourceCompatibility = 1.8 
targetCompatibility = 1.8 

repositories { 
    mavenCentral() 
} 

dependencies { 
    compile('org.springframework.boot:spring-boot-starter-actuator') 
    compile('org.springframework.cloud:spring-cloud-starter-eureka') 
    compile('org.springframework.cloud:spring-cloud-starter-ribbon') 
    compile('org.springframework.boot:spring-boot-starter-web') 
    testCompile('org.springframework.boot:spring-boot-starter-test') 
} 

dependencyManagement { 
    imports { 
     mavenBom "org.springframework.cloud:spring-cloud-starter-parent:Brixton.RELEASE" 
    } 
} 

eclipse { 
    classpath { 
     containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER') 
     containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8' 
    } 
} 

task wrapper(type: Wrapper) { 
    gradleVersion = '2.13' 
} 

これが機能しました。幸いにも、私はSpring Boot 1.4.x特有の機能を使用していないので、私のビルドは何の問題もなくなりました。私は私のアプリをテストし、うまく見えた。ご覧のとおり、私はSpringのリポジトリを使用していません。私の依存関係はすべてmavenCentral()から解決されています。

これはSpringのMaven Repoに問題がある場合、どのように問題が起きているのですか(ほぼ24時間後)、これを報告する人はいませんか?私はこれをグーグルで過ごしていましたが、私はこれに関する実質的な注意や懸念を見つけることはできません。そしてそのために、私が何か非常に基本的なことを間違っているのかどうか、あるいは私はある種の発見者です。

答えて

1

以下のようにmavenBomの依存関係を変更してみてください。私たちは同じ問題に直面していました。

dependencyManagement { 
    imports { 
    mavenBom 'org.springframework.cloud:spring-cloud-dependencies:Brixton.RELEASE' 
    } 
} 
関連する問題