pditommaso
pditommaso

Reputation: 3381

How to include a dependency to parent test classes for a submodule in a Gradle multiple project build?

I have a multiple project Gradle build in which a submodule need to reference some helper classes defined in the parent module test configuration.

In the submodule I've added the following definition:

dependencies {
    compile project(path: ':')
    testCompile project(path: ':', configuration: 'testCompile')
}

However the submodule test compilation faila because it is unable to resolve classes defined in the parent testCompile configuration.

How to reference the parent test configuration in a submodule in a Gradle build ?

Upvotes: 0

Views: 2251

Answers (1)

CyberAleks
CyberAleks

Reputation: 1603

compile project(project.parent.path)
testCompile project(project.parent.path, configuration: 'testCompile')

If you need configuration, you can find it like this:

project.parent.configurations.testCompile

UPDATE

Solution:

testCompile files(project.parent.sourceSets.test.output)

Upvotes: 1

Related Questions