Separating Android project into dev and prod environment

I have a large multi module project which consist android and java libraries.
My end goal is to build the code for source code when we selected devDebug/devRelease,
And from the libraries when we selected prodDebug/prodRelease.

Using Android studio enable us to select a build variant and then the rest of the variants are synced to be with the same flavor of the app. So if i have chosen devDebug variant then the rest of the android libraries would switch to devDebug.
Android let us do it with ease, just define:
“devImplementation”(project(“:core:license_common”))
“prodImplementation”(libs.trekace.core.licenseCommon)
And then it will know on which dependency to use.
The problem with regular java libraries which doesnt have build variants. assuming we have a module called license_common which is a regular java library.

License common is depended upon:
// implementation(project(":core:pki”)) // should be used in dev
// implementation(libs.trekace.core.pki) // should be used in prod
How can I make it select the correct dependencies ?

(I have tried to declare a configuration of my own called “devImplementation” in the java library but then using implement(project(":core:license_common”, configuration = “devImplementation”)) was not working - sync would pass but the classes declared in license_common could not be resolved)