Gradleのバーションを久々に更新したら、一部のプロジェクトでエラーが出てました。
その時の対処を紹介します。
エラー内容
gradle eclipse
を実行するとbuild.gradleの15行目でエラーが発生と表示されます。
$ gradle eclipse FAILURE: Build failed with an exception. * Where: Build file '/Users/Applications/eclipse/workspace/Test/build.gradle' line: 15 * What went wrong: A problem occurred evaluating root project 'Test'. > Failed to apply plugin [class 'io.spring.gradle.dependencymanagement.DependencyManagementPlugin'] > Could not create task of type 'DependencyManagementReportTask'. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 0s
build.gradle
問題の15行目は、apply 'spring-boot'
の宣言です。
buildscript { ext { springBootVersion = '1.3.6.RELEASE' } repositories { mavenCentral() } dependencies { classpath 'org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}' // Gradle4対応 classpath 'io.spring.gradle:dependency-management-plugin:0.6.0.RELEASE' } } apply plugin: 'java' apply plugin: 'eclipse-wtp' apply plugin: 'spring-boot' // line: 15 以下略
対処法
buildscript { ext { springBootVersion = '1.3.6.RELEASE' } repositories { mavenCentral() } dependencies { classpath 'org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}' // 追加 classpath 'io.spring.gradle:dependency-management-plugin:0.6.0.RELEASE' } } apply plugin: 'java' apply plugin: 'eclipse-wtp' apply plugin: 'spring-boot' // 追加 apply plugin: 'io.spring.dependency-management'