granadaCoder
granadaCoder

Reputation: 27842

quarkus and jandex and explicit jpa entities

I'm getting errors in JPA entities in my quarkus proof of concept.

2019-10-24 13:08:09,303 WARN  [io.qua.agr.dep.AgroalProcessor] (build-27) Agroal dependency is present but no driver has been defined for the default datasource
2019-10-24 13:08:09,515 WARN  [io.qua.dep.ste.ReflectiveHierarchyStep] (build-20) Unable to properly register the hierarchy of the following classes for reflection as they are not in the Jandex index:
        - com.me.quaaaaaaakusone.domain.EmployeeEntity
        - com.me.quaaaaaaakusone.domain.JobTitleEntity
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.");.

I found this post:

How to create a Jandex index in Quarkus for classes in a external module

and I did what the SOF answer says, which is also in the logs:

an empty META-INF/beans.xml

But I still get the above WARN.

Really what I am after is:

How do I EXPLICITLY tell quarkus about the location of my JPA entities.

My primary goal is to reduce the startup time, so I am trying to avoid (excess) scanning as much as possible.

I'm using Gradle, so I'm having trouble identifying the groupid and artifactid of my submodules.

I found this:

https://plugins.gradle.org/plugin/org.galaxx.gradle.jandex

but it does not tell you how to implement it. << Gaaaaaaaaa

Contrary to the simple examples. I have layered my code and I have (sub)modules for the entities in a :domain submodule.

My folder structure looks like this:

myRootFolder\apicore\src\main\java
myRootFolder\apicore\src\main\resources

myRootFolder\dal\src\main\java
myRootFolder\dal\src\main\resources

myRootFolder\domain\src\main\java
myRootFolder\domain\src\main\resources

myRootFolder\restlayer\src\main\java
myRootFolder\restlayer\src\main\resources

My settings.gradle looks like this:

pluginManagement {
    repositories {
        mavenLocal()
        mavenCentral()
        gradlePluginPortal()
    }
    resolutionStrategy {
        eachPlugin {
            if (requested.id.id == 'io.quarkus') {
                useModule("io.quarkus:quarkus-gradle-plugin:${quarkusVersion}")
            }
        }
    }
}

rootProject.name = 'quaaaaaaakusoneRoot'

include 'domain'
include 'dal'
include 'apicore'
include 'restlayer'

Upvotes: 1

Views: 907

Answers (1)

tellisnz
tellisnz

Reputation: 568

Add this plugin to the build.gradle of your domain module. This will create a jandex index inside the jar containing your domain entities, which is then used by quarkus when building images.

Upvotes: 1

Related Questions