未检测到H2模块

我正在使用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

keke0328 回答:未检测到H2模块

切换到SQLite,效果很好

本文链接:https://www.f2er.com/3138488.html

大家都在问