首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Quarkus中将javax.persistence.criteria.*类添加到Jandex索引?

如何在Quarkus中将javax.persistence.criteria.*类添加到Jandex索引?
EN

Stack Overflow用户
提问于 2019-11-17 23:42:08
回答 1查看 303关注 0票数 1

我正在尝试修复Quarkus应用程序中的以下警告:

代码语言:javascript
复制
2019-11-17 16:21:34,191 INFO  [io.qua.dep.QuarkusAugmentor] (main) Beginning quarkus augmentation
2019-11-17 16:21:34,975 WARN  [io.qua.dep.ste.ReflectiveHierarchyStep] (build-11) Unable to properly register the hierarchy of the following classes for reflection as they are not in the Jandex index:
        - javax.persistence.criteria.CriteriaBuilder
        - javax.persistence.criteria.Predicate
        - javax.persistence.criteria.Root
        - kotlin.jvm.functions.Function3
Consider adding them to the index either by creating a Jandex index for your dependency via the Maven plugin, an empty META-INF/beans.xml or quarkus.index-dependency properties.");.

我使用gradle,并且我只有一个模块,没有子模块。这是我的build.gradle

代码语言:javascript
复制
buildscript {
    ext {
        kotlinVersion = '1.3.50'
        quarkusVersion = '1.0.0.CR1'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "io.quarkus:quarkus-gradle-plugin:${quarkusVersion}"
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
        classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
        classpath("org.jetbrains.kotlin:kotlin-noarg:${kotlinVersion}")
    }
}

plugins {
    id 'io.quarkus' version '1.0.0.CR1'
}

apply plugin: 'kotlin'
apply plugin: 'kotlin-jpa'

group = 'com.mkleimann'
version = '0.0.3-SNAPSHOT'

repositories {
    mavenCentral()
}

quarkus {
    setSourceDir("src/main/kotlin")
    setOutputDirectory("build/classes/kotlin/main")

    buildNative {
        setAdditionalBuildArgs(["-H:EnableURLProtocols=http"])
    }
}


compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
    kotlinOptions.jvmTarget = "1.8"
}

test {
    useJUnitPlatform()
}

dependencies {
    implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jdk8', version: "${kotlinVersion}"

    implementation enforcedPlatform("io.quarkus:quarkus-bom:${quarkusVersion}")
    implementation "io.quarkus:quarkus-kotlin:${quarkusVersion}"
    implementation "io.quarkus:quarkus-resteasy-jackson:${quarkusVersion})"
    implementation "io.quarkus:quarkus-undertow:${quarkusVersion})"
    implementation "io.quarkus:quarkus-jdbc-postgresql:${quarkusVersion}"
    implementation "io.quarkus:quarkus-hibernate-orm-panache:${quarkusVersion}"
    implementation "io.quarkus:quarkus-oidc:${quarkusVersion}"

    implementation 'com.aventrix.jnanoid:jnanoid:2.0.0'
    implementation group: 'org.jboss.resteasy', name: 'resteasy-multipart-provider', version: '4.2.0.Final'
    implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.10.0'
    implementation group: 'com.fasterxml.jackson.module', name: 'jackson-modules-java8', version: '2.10.0', ext: 'pom'

    testCompile group: 'io.quarkus', name: 'quarkus-junit5', version: "${quarkusVersion}"
    testCompile(group: 'io.rest-assured', name: 'rest-assured', version: '3.3.0') {
        exclude(module: 'activation')
        exclude(module: 'jaxb-osgi')
    }
}

因为我使用gradle,所以我不能使用maven jandex插件。我还尝试添加一个空的beans.xml,但仍然收到相同的警告。

对于使用application.properties的第三种选择,我不知道该放什么,因为这些只是JPA类(和kotlin类)。

另外,我没有在代码中直接注入这些类,所以我不确定这个警告来自哪里。

将这些类添加到Jandex索引的正确方法是什么?

EN

回答 1

Stack Overflow用户

发布于 2019-11-18 01:53:35

我认为尝试理解为什么需要这些类是一个更好的想法。

如果你能从你的代码中提取一个复制器,你能打开一个GitHub问题吗?我很想看看是哪些模式导致这些类是必需的。

我们可能需要稍微调整一下规则。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58902190

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档