Gradle编译报错

Posted passedbylove

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Gradle编译报错相关的知识,希望对你有一定的参考价值。

问题重现

gradle build
A problem occurred evaluating root project ‘Spring4WebSocket‘.
> Failed to apply plugin [class ‘io.spring.gradle.dependencymanagement.DependencyManagementPlugin‘]
   > Could not create task of type ‘DependencyManagementReportTask‘.

 

解决方法

添加 classpath("io.spring.gradle:dependency-management-plugin:0.6.1.RELEASE")

buildscript {
    repositories {
        maven { url "http://repo.spring.io/libs-release" }
        mavenLocal()
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE")
        classpath("io.spring.gradle:dependency-management-plugin:0.6.1.RELEASE")
    }
}

apply plugin: ‘java‘
apply plugin: ‘eclipse‘
apply plugin: ‘spring-boot‘
apply plugin: ‘war‘
apply plugin: ‘java‘
apply plugin: ‘maven‘
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenLocal()
    mavenCentral()
    maven { url "http://repo.spring.io/libs-release" }
}
bootRepackage {
    enabled false
}
dependencies {
    compile("org.springframework.boot:spring-boot-starter-websocket")
    compile("org.springframework:spring-messaging")
    providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")
    compile ‘jstl:jstl:1.2‘
}

再次编译顺利通过

参考:3.0 M1: SpringBoot-1.3.5 project fails to build, aborts with an error message on creation of DependencyManagementReportTask

以上是关于Gradle编译报错的主要内容,如果未能解决你的问题,请参考以下文章

错误记录Android Studio 编译报错 ( Could not determine java version from ‘11.0.8‘. | Android Studio 降级 )(代码片段

错误记录Android Studio 编译报错 ( Could not determine java version from ‘11.0.8‘. | Android Studio 降级 )(代码片段

错误记录Android Studio 中编写 Gradle 编译脚本时没有 Groovy 代码提示 ( Cannot find declaration to go to )

错误记录IntelliJ IDEA 编译 Groovy 项目报错 ( gradle-resources-test:XX: java.lang.NoClassDefFoundError: org )

Gradle编译报错

使用Gradle编译release apk报错:Please correct the above warnings first