I have subprojects X and Common, and while both compile just fine, the tests for X seem to fail at runtime because Common is not present, despite having tried to add it with runtime, testRuntime, testImplementation, etc.
root build.gradle:
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version "$kotlin_version"
id "com.github.johnrengelman.shadow" version "$shadow_version"
}
group = 'com.martmists'
version = project_version
archivesBaseName = rootProject.name + "-all"
allprojects {
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'com.github.johnrengelman.shadow'
project.version = rootProject.version
project.group = rootProject.group
project.setBuildDir(rootProject.getBuildDir())
repositories {
mavenCentral()
maven {
name = "Jitpack"
url = "https://jitpack.io"
}
}
configurations {
// Make shade act as both implementation and testRuntime
implementation.extendsFrom shade
testRuntime.extendsFrom shade
}
jar {
enabled = false
}
shadowJar {
enabled = true
configurations = [project.configurations.shade]
classifier = ""
}
build.dependsOn(shadowJar)
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16
compileKotlin.kotlinOptions.jvmTarget = "16"
compileKotlin.kotlinOptions.useIR = true
compileTestKotlin.kotlinOptions.jvmTarget = "16"
compileTestKotlin.kotlinOptions.useIR = true
}
subprojects {
archivesBaseName = rootProject.name + "-" + project.name
rootProject.build.dependsOn(build)
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib"
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.2'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.4.2'
}
test {
useJUnitPlatform()
include 'com/martmists/**'
}
}
X build.gradle:
dependencies {
shade project(path: ":common", configuration: "shadow")
testRuntime project(path: ":common", configuration: "shadow")
}