'unresolved supertypes: javax.sql.DataSource

I am seeing the following error when trying to compile using gradle.

Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath: class com.zaxxer.hikari.HikariDataSource, unresolved supertypes: javax.sql.DataSource Adding -Xextended-compiler-checks argument might provide additional information.

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
    //kotlin("jvm") version "1.6.0"
}

group = "com.jasin"
version = "0.0.1"

dependencies {
    //api(files("libs/jdbc-stdext-2.0.jar"))
    implementation("org.ktorm:ktorm-core:3.4.1")
    implementation("org.ktorm:ktorm-support-mysql:3.4.1")
    implementation("mysql:mysql-connector-java:8.0.25")
    implementation("com.zaxxer:HikariCP:5.0.1")
    implementation("org.slf4j:slf4j-api:1.7.36")
    implementation("org.slf4j:slf4j-simple:1.7.36")
    testImplementation(kotlin("test"))
}

tasks.test {
    useJUnit()
}

tasks.withType<KotlinCompile>() {
    kotlinOptions.jvmTarget = "11"
}

If I uncomment the following line

//api(files("libs/jdbc-stdext-2.0.jar"))

I get the following type errors

module jdbc.stdext reads package javax.sql from both jdbc.stdext and java.sql

If I recomment this line and try to build again(without cleaning the project), it works. As soon as I clean the project the error reappears. What is exactly going on here and how can I fix this? Any help would be appreciated.

edit: I should add that this is a multi-module project and it wasn't till I tried to define module-info.java files in separate modules that this error appeared. But the error is specific to one module, the module that I use to access my database that uses connection pooling with hikaricp.

module-info.java file

module com.cobis.db {
    requires kotlin.stdlib;
    requires com.zaxxer.hikari;
    requires ktorm.core;

    exports com.cobis.db;
    exports com.cobis.db.entities;
    exports com.cobis.db.utilities;
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source