St.Antario
St.Antario

Reputation: 27435

Gradle settings and dependencies

Imagine we have two projects:

root
 |
 |--MP
 |
 |--API

In these project MP use classes defined in API. I write settings.gradle file in the root directory:

include 'API', 'MP'

and build.gradle in that directory:

subprojects{
    apply plugin : 'java'

    repositories{
        mavenCentral()
    }

    version = '1.0'

    jar{
        manifest{
            attributes 'Gradle': 'Multiproject'
        }
    }
}

But if I don't create the following build.gradle in MP:

dependencies {
    compile project(':API')
}

it won't work. I thought settings.gradle define that we may use API in MP or vice versa during compilation.

Upvotes: 1

Views: 48

Answers (1)

Radim
Radim

Reputation: 4808

This is as designed. You have two subprojects and each of them has its own sources and dependencies. Applying the same customization using the subprojects closure doesn't merge them.

Upvotes: 2

Related Questions