How do you define the project dependency to include the -stubs jar?
For instance I have a multi module project.
I have my contracts project that contains all the stubs.
Then in project a I do
implementation(project(":contracts"))
This doesn't put the stubs jar on the class path.
How do I specify the project dependency to bring in the stubs jar?
Ok so the only way for me to get this to work was the following.
In the contracts module build.gradle.kts(this is using kotlin DSL):
val stubs by configurations.creating {
isCanBeConsumed = true
isCanBeResolved = false
}
artifacts {
add("stubs", tasks.verifierStubsJar.get())
}
Then on the consumer side:
testImplementation(project(":libs:contracts", "stubs"))
Using testImplementation is important here. If you only do runtime, the jars in contract module need to be prebuilt. Using testImplementation forces the dependency to be built at the time you build the project (i.e like you do when executing a test)