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

问题描述 投票:0回答:1

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

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

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索引的正确方法是什么?

java gradle kotlin quarkus
1个回答
0
投票

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

如果您可以从代码中提取复制器,您可以打开GitHub问题吗?我很想知道哪种模式导致需要这些类。

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

© www.soinside.com 2019 - 2024. All rights reserved.