I have a multi-module project set up that creates a gradle plugin. I have a couple modules that are treated as libraries (and which I export separately), and a couple of modules using those libraries to produce custom plugins. I want to create a partial fat jar of ONLY the local modules and the plugin module. I am able to create this jar (using the shadow plugin or the jar task), but what I am not able to do is then execute tests. No matter what combination of dependency configurations I try, the tests are always missing the library module classes, and fail with ClassNotFoundException. What am I missing that can resolve this?
plugins {
kotlin("jvm")
id("java-gradle-plugin")
id("com.github.johnrengelman.shadow") version "8.1.1"
}
val libraries: Configuration by configurations.creating
dependencies {
compileOnly(project(":base"))
shadow(libs.mydependency)
testImplementation(testFixtures(project(":test")))
testImplementation(project(":base"))
libraries(project(":base")) {
isTransitive = false
}
}
tasks {
test {
useJUnitPlatform()
}
shadowJar {
archiveClassifier.set("")
configurations = listOf(libraries)
}
}