未检测到H2模块

时间:2019-11-08 11:00:13

标签: gradle build.gradle h2 java-11

我正在使用Java 11开发具有Hibernate和H2数据库的JavaFX应用程序,所有依赖项都使用IntelliJ Idea 2019.1.4通过Gradle 5.6.2导入。

尽管库是导入节,但未检测到

H2自动模块名称com.h2database

我的build.gradle文件:

plugins {
    id 'java'
    id 'application'
    id 'org.openjfx.javafxplugin' version '0.0.8'
}

group 'org.sarc'
version '1.0-SNAPSHOT'

sourceCompatibility = 11

javafx {
    version = "11"
    modules = [ 'javafx.controls','javafx.fxml' ]
}

repositories {
    mavenCentral()
}

dependencies {
// https://mvnrepository.com/artifact/org.hibernate/hibernate-core
    compile group: 'org.hibernate', name: 'hibernate-core', version: '5.4.8.Final'
// https://mvnrepository.com/artifact/com.h2database/h2
    testCompile group: 'com.h2database', name: 'h2', version: '1.4.200'

}

还有我的module-info.java文件:

module vtcc {
    requires java.sql;
    requires javafx.controls;
    requires javafx.fxml;
    requires org.hibernate.orm.core;
    requires java.persistence;
    requires com.h2database;
}

现在,最后一个要求intelliJ告诉我module is not in dependencies

1 个答案:

答案 0 :(得分:0)

切换到SQLite,效果很好