我正在将 Java EE 项目迁移到 Quarkus,但 Quarkus 构建和 jandex 出现问题
我为 Quarkus 创建了一个子模块,类似于:
apply plugin: 'io.quarkus'
dependencies {
implementation project(':core')
}
我的核心子模块看起来类似于:
apply plugin: 'org.kordamp.gradle.jandex'
dependencies {
implementation 'io.quarkus:quarkus-hibernate-validator'
implementation 'io.quarkus:quarkus-hibernate-orm'
}
jandex 文件在 core/build/jandex 中创建并添加到核心 jar 中,但构建仍然失败,并显示:
> Task :quarkus:quarkusBuild FAILED
building quarkus runner
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':quarkus:quarkusBuild'.
> io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor#build threw an exception: io.quarkus.deployment.configuration.ConfigurationError: Unable to properly register the hierarchy of the following JPA classes as they are not in the Jandex index:
- ...
我尝试使用以下方法复制 jandex 文件:
task copyJandex {
copy {
from "${project(':core').buildDirectory.file("jandex/jandex.idx").get()}"
into "build/resources/main/META-INF"
}
}
classes.dependsOn copyJandex
但这并没有解决问题。
关于什么可能是错误的任何想法?