Composite build with test sources

I have proj2 depending on proj1. proj2 also requires proj1 for test sources because the test classes in proj2 depending on test classes in proj1. I am trying to get this to work using composite build functionality without success.

proj2: settings.gradle
includeBuild file('../proj1/')
proj2: build.gradle
    compile 'app1:proj1:+'
    testCompile 'app1:proj1:+:testArtifacts'
proj1: build.gradle
configurations {
    testArtifacts.extendsFrom testRuntime

task testJar(type: Jar) {
    classifier = 'test'
    from sourceSets.test.output
    testArtifacts testJar

When i try this i get the error in intellij
Error:Can’t parse gradle module dependency ‘DefaultIdeaModuleDependency{scope=‘IdeaDependencyScope{scope=‘COMPILE’}’, targetModuleName=‘proj1’, exported=false}’. Reason: referenced module is null

and this error on the command line

  • What went wrong:
    Could not resolve all dependencies for configuration ‘:testCompileClasspath’.

Could not find proj1-testArtifacts.jar (app1:proj1:unspecified).

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Is this possible?

Whilst not an answer to your question, it’s worth noting that nebula have deprecated their nebula.test-jar plugin for the following reason

We will be removing this functionality in the next major release. We feel it is better to create a project for any shared test harnesses than to try and create an extra jar out of the test classes.

Composite build does not yet support custom configurations or publications.

Thanks for your replies. Will support for this be coming? If so do you have a time frame?

Yes it will come, I don’t have a clear time frame though. Definitely not this year anymore.

What the status of that?