gpt4 book ai didi

Java 9 : jigsaw and hibernate 5. 2.12 不工作

转载 作者:搜寻专家 更新时间:2023-11-01 02:57:54 25 4
gpt4 key购买 nike

在我的 pom.xml 文件中,我只有一个依赖项:

<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.12.Final</version>
</dependency>
</dependencies>

还有一个module-info.java

module testmodule {
requires hibernate.jpa;
requires hibernate.core;
}

但是当我尝试运行我的应用程序时出现错误:Caused by: java.lang.IllegalArgumentException: jboss.transaction.api.1.2.spec: Invalid module name: '1' is not a Java 标识符。任何想法如何处理它?<​​/p>

最佳答案

从堆栈跟踪来看,异常不是针对 hibernate-core 模块,而是针对jboss-transaction-api_1.2_spec 依赖项包含在您的项目中。

直到版本 1.0.1.Final 的依赖项,自动模块名称无法从 jar 文件名派生。

enter image description here

这已经在 2017 年 10 月发布的 2.0.0.Alpha1 版本中进行了更新,现在有一个 module-info.class 打包在 jar 中以从中获取模块名称。

因此,您最好使用模块名称为 java.transaction2.0.0.Alpha1 版本作为:

<dependency>
<groupId>org.jboss.spec.javax.transaction</groupId>
<artifactId>jboss-transaction-api_1.2_spec</artifactId>
<version>2.0.0.Alpha1</version>
</dependency>

enter image description here

关于Java 9 : jigsaw and hibernate 5. 2.12 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47821744/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com