【问题标题】:Intellij could not compile gradle projectIntellij 无法编译 gradle 项目
【发布时间】:2016-08-05 19:23:56
【问题描述】:

我是 Gradle 构建系统的新手。我想在 IntelliJ IDEA 2016.1 Community Edition 中使用 gradle。

  • 我使用向导创建了一个 gradle 项目。
  • 创建了一个简单的 javafx 应用程序
  • 我尝试构建项目并遇到错误

错误:gradle-resources-test:aMaze_test: java.lang.NoClassDefFoundError: org/apache/tools/ant/util/ReaderInputStream

build.gradle

group 'aryanware'
version '1.0-SNAPSHOT'

apply plugin: 'java'

sourceCompatibility = 1.5

repositories {
    mavenCentral()
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.11'
}

AmazeWindow.java

package aryanware.amaze;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class AmazeWindow extends Application {
    @Override
    public void start(Stage primaryStage) {
        Group root = new Group();
        Scene scene = new Scene(root, 300, 250);

        primaryStage.setTitle("Hello World!");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}

项目结构

我对 gradle 的工作原理一无所知。所以我自己无法解决这个错误。

【问题讨论】:

  • 从命令行构建是否有效? (运行./gradlew build

标签: java intellij-idea gradle


【解决方案1】:

我在论坛和接缝中检查过它是 Intellij 问题。建议的解决方法是使缓存失效。

IntelliJ/Invalidate caches

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-10-27
    • 2019-09-14
    • 1970-01-01
    • 2014-08-27
    • 1970-01-01
    • 1970-01-01
    • 2020-07-14
    • 1970-01-01
    相关资源
    最近更新 更多