Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quarkus-reactive-pg-client not detected when using gradle #19156

Closed
Eng-Fouad opened this issue Aug 2, 2021 · 3 comments · Fixed by #19906
Closed

quarkus-reactive-pg-client not detected when using gradle #19156

Eng-Fouad opened this issue Aug 2, 2021 · 3 comments · Fixed by #19906
Labels
area/gradle Gradle kind/bug Something isn't working
Milestone

Comments

@Eng-Fouad
Copy link
Contributor

Eng-Fouad commented Aug 2, 2021

Describe the bug

I cloned this example project: https://github.com/quarkusio/quarkus-quickstarts/tree/main/hibernate-reactive-panache-quickstart, and I replaced maven with gradle.

When I try to build the project:

gradlew build -x test

the following error occurs:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':quarkusBuild'.
> io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.agroal.deployment.AgroalProcessor#build threw an exception: io.quarkus.runtime.configuration.ConfigurationException: Unable to find a JDBC driver c
orresponding to the database kind 'postgresql' for the default datasource. Either provide a suitable JDBC driver extension, define the driver manually, or disable the JDBC datasource by
adding 'quarkus.datasource.jdbc=false' to your configuration if you don't need it.
        at io.quarkus.agroal.deployment.AgroalProcessor.resolveDriver(AgroalProcessor.java:332)
        at io.quarkus.agroal.deployment.AgroalProcessor.getAggregatedConfigBuildItems(AgroalProcessor.java:278)
        at io.quarkus.agroal.deployment.AgroalProcessor.build(AgroalProcessor.java:83)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2442)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1450)
        at java.base/java.lang.Thread.run(Thread.java:831)
        at org.jboss.threads.JBossThread.run(JBossThread.java:501)

gradle.properties:

quarkusPluginVersion=2.1.0.Final
quarkusPlatformArtifactId=quarkus-bom
quarkusPluginId=io.quarkus
quarkusPlatformGroupId=io.quarkus
quarkusPlatformVersion=2.1.0.Final
org.gradle.warning.mode=all
org.gradle.logging.level=INFO

settings.gradle.kts:

pluginManagement {

    val quarkusPluginId: String by settings
    val quarkusPluginVersion: String by settings

    repositories {
        mavenLocal()
        mavenCentral()
        gradlePluginPortal()
    }

    plugins {
        id(quarkusPluginId) version quarkusPluginVersion
    }
}

rootProject.name = "foo-backend"

build.gradle.kts:

// Project properties can be accessed via delegation
val quarkusPlatformGroupId: String by project
val quarkusPlatformArtifactId: String by project
val quarkusPlatformVersion: String by project

plugins {
    java
    id("io.quarkus")
}

group = "io.fouad.foo"
version = "1.0.0"

repositories {
    mavenCentral()
    mavenLocal()
}

dependencies {
    implementation(enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}"))
    implementation("io.quarkus:quarkus-resteasy-reactive-jackson")
    implementation("io.quarkus:quarkus-resteasy-reactive")
    implementation("io.quarkus:quarkus-hibernate-reactive-panache")
    implementation("io.quarkus:quarkus-reactive-pg-client")
    testImplementation("io.quarkus:quarkus-junit5")
    testImplementation("org.assertj:assertj-core")
    testImplementation("io.rest-assured:rest-assured")
}

tasks {

    java {
        sourceCompatibility = JavaVersion.VERSION_16
        targetCompatibility = JavaVersion.VERSION_16
    }

    compileJava {
        options.encoding = "UTF-8"
        options.compilerArgs = listOf("-parameters", "-Xdoclint:none", "-Xlint:all", "-Xlint:-exports", "-Xlint:-serial", "-Xlint:-try",
                                      "-Xlint:-requires-transitive-automatic", "-Xlint:-requires-automatic", "-Xlint:-processing")
    }

    compileTestJava {
        options.encoding = "UTF-8"
        options.compilerArgs = listOf("-parameters", "-Xdoclint:none", "-Xlint:all", "-Xlint:-exports", "-Xlint:-serial", "-Xlint:-try",
                                      "-Xlint:-requires-transitive-automatic", "-Xlint:-requires-automatic", "-Xlint:-processing")
    }

    jar {
        archiveBaseName.set("foo-backend")
    }

    test {
        useJUnitPlatform()
    }

    quarkusBuild {
        nativeArgs {
            "container-build" to true
        }
    }

}

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

Windows 10

Output of java -version

Java 16

GraalVM version (if different from Java)

No response

Quarkus version or git rev

Quarkus 2.1.0.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Gradle 7.1.1

Additional information

No response

@Eng-Fouad Eng-Fouad added the kind/bug Something isn't working label Aug 2, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Aug 2, 2021

/cc @glefloch, @quarkusio/devtools

@quarkus-bot quarkus-bot bot added the area/gradle Gradle label Aug 2, 2021
@Eng-Fouad
Copy link
Contributor Author

Eng-Fouad commented Aug 2, 2021

Workaround

Adding the following extra dependency solved the problem:

implementation("io.quarkus:quarkus-jdbc-postgresql")

also I had to add the following to application.properties:

quarkus.datasource.jdbc=false

@glefloch
Copy link
Member

glefloch commented Sep 2, 2021

Thanks for reporting this @Eng-Fouad.

The problem seems to come from the way we are building the deployment classpath in gradle.
Too many extensions are included (quarkus-agroal in that case) whereas, it should have been excluded.

FYI @aloubyansky, I'm on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gradle Gradle kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants