首页 > 解决方案 > 尝试在 Intellij Idea 中构建 gradle 项目时出错

问题描述

我正在尝试在 Coursera 上完成 Java Spring 课程,并使用此 gradle 文件下载了该项目。

buildscript {
    ext {
        springBootVersion = '2.1.0.RELEASE'
    }
    repositories {
        maven { url "https://repo.spring.io/libs-snapshot" }
        mavenLocal()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.0.2.RELEASE")
    }
}

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

sourceCompatibility = 1.8
targetCompatibility = 1.8

war {
    baseName = 'gs-convert-jar-to-war'
    version =  '0.1.0'
}

repositories {
    mavenCentral()
    maven { url "https://repo.spring.io/libs-snapshot" }
    maven { url "http://maven.springframework.org/milestone" }

    flatDir {
        dirs 'lib'
    }
}

dependencies {

    compile("org.springframework.boot:spring-boot-starter-web")
    compile("org.springframework.boot:spring-boot-starter-actuator")
    compile("org.springframework.boot:spring-boot-starter-aop")
    compile("org.springframework.boot:spring-boot-starter-test")
    compile("org.springframework.boot:spring-boot-starter-jetty")
    compile("org.springframework.boot:spring-boot-starter-data-jpa")
    compile("org.springframework.data:spring-data-rest-webmvc")


    compile("org.apache.httpcomponents:httpclient:4.5.6")


    compile("org.hsqldb:hsqldb")

    compile("com.google.guava:guava:17.0")
    compile("org.apache.commons:commons-lang3:3.3.2")
    compile("com.squareup.retrofit:retrofit:1.6.0")
    compile("commons-io:commons-io:2.4")

    compile("com.github.davidmarquis:fluent-interface-proxy:1.3.0")
    compile(":mobilecloud.handin:1.0.0")
    compile(":video.up.test:1.0.0")
    compile(":autograder.handin:1.0.0")
    compile(":autograder.spec:1.0.0")

    testCompile("junit:junit")
}

不幸的是,我在 IntelliJ Idea 中有这个错误:

A problem occurred configuring root project 'mobile-cloud-asgn1'.
> Failed to notify project evaluation listener.
   > org.gradle.api.tasks.SourceSetOutput.getClassesDir()Ljava/io/File;

我是 Java 和 Gradle 的新手,从来没有遇到过这样的错误,所以我不知道如何修复它。谁能帮我?
带有项目模板的 PS 存储库:https ://github.com/juleswhite/mobile-cloud-asgn1

标签: javaspring-bootgradleintellij-idea

解决方案


推荐阅读