Jing-Wei Lu
04/02/2025, 5:01 AMproject1
I got
task testJar(type: Jar) {
dependsOn classes
archiveClassifier = 'tests'
from sourceSets.test.allSource
}
tasks.named('assemble').configure {
dependsOn 'testJar'
}
configurations {
testArtifacts
}
artifacts {
testArtifacts testJar
}
then in project2
testImplementation project(path: ':project1', configuration: 'testArtifacts')
but during build those dependencies cannot be resolved. What is the recommended way to do this? I am on 7.6.2
ephemient
04/02/2025, 6:21 AMVampire
04/02/2025, 6:48 AMallSource
into the jar, that is the source files and thus you cannot use the classes of course. Also iirc classes
depends on the tasks that compile production sources, testClasses
depends on the tasks that compile test sources. And that you think you "need" that explicit dependency is also already a strong sign, that you do something wrong. Basically any explicit dependsOn
that does not have a lifecycle task on its left-hand side is a code smell and usually means something is wrong.