Rob Wilkinson
Rob Wilkinson

Reputation: 1307

How to configure sub project to inherit the configuration of build.gradle file in parent project in Flat layout

We have an existing maven project with below flat structure. I am trying to convert it to use Gradle

|
---Parent Module
|
---Sub Module 1
|
---Sub Module 2
     |
     ----Sub Module 21

The Parent Module, "Sub Module 1" and "Sub Module 2" are at same level in folder hierarchy.

How can build.gradle files in "Sub Module 1" and "Sub Module 2" can inherit the configuration from Parent Module's build.gradle file.

In Maven we can specify the relativePath for parent in sub modules.

Please note we cannot change the folder structure to Hierarchical.

Upvotes: 2

Views: 1294

Answers (1)

JBirdVegas
JBirdVegas

Reputation: 11413

In the Parent Module specify the subproject closure with your configurations

subprojects {
    group = 'com.my.company'
    version = '1.0.0'
}

Here you can specify things that will be applied to all sub modules.

Upvotes: 1

Related Questions