I have a core build which creates a code jar (without classifier) and a tests jar (with classifier “tests”). This is declarded using:
// tests jar
task testJar(type: Jar) {
classifier = 'tests'
from sourceSets.test.output
}
// artifacts
artifacts {
archives jar, testJar
}
From another project I am referencing this test jar as:
// dependencies
dependencies {
[...]
testInclude group: 'group', name: 'core-main', version: '1.0.0', classifier: 'tests'
}
testInclude is a custom configuration that gets extracted into a build directory to run the tests.
The problem is that if I combine these builds into a composite build I get the error:
Execution failed for task ':explodedTests'.
> Could not resolve all files for configuration ':testInclude'.
> Could not find core-main-tests.jar (project :core:core-main).
What am I doing wrong or does it simply not work with composite builds? In that case what are the alternatives?
Edit:
Yes I’ve read (in old posts) that composite builds don’t support classifiers but according to the error message the classifier is considered. So I guess the old posts are out of date. The problem just seems to be that the searched jar doesn’t contain the version because a file core-main-1.0.0-tests.jar is created?