I am building a Kotlin library and several web services which are all consumers of the library. The library defines database models, which the web services can then all commonly access and manipulate.
Here is the build.gradle file for my library:
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.4.10'
}
group 'org.bioround'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
jcenter()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib"
api "org.jetbrains.exposed:exposed-core:$exposed_version"
api "org.jetbrains.exposed:exposed-dao:$exposed_version"
api "org.jetbrains.exposed:exposed-jdbc:$exposed_version"
implementation "mysql:mysql-connector-java:$mysqlconnector_version"
implementation "com.zaxxer:HikariCP:$hikaricp_version"
}
Note how the org.jetbrains.exposed dependencies are declared as api dependencies, since I want to access the methods these dependencies provide in my web services.
Here is the build.gradle file for one of my consumers, where I declare mylibrary as a local dependency:
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.4.10'
}
group 'org.bioround'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib"
implementation files("../mylibrary/build/libs/mylibrary-1.0-SNAPSHOT.jar")
}
However, I am unable to access the methods from org.jetbrains.exposed in my consumer service. I expected the methods to be available since I declared them as api dependencies in my library.
What am I doing wrong here?