Ingo Kegel
Ingo Kegel

Reputation: 47975

Remove middle directory in multi-project gradle build

In a multi-project build I have a "modules" directory that contains several sub-projects.

Instead of referencing a sub-project A via project(':modules:A'), I would like to reference it as project(':A').

Is it possible to tell gradle to eliminate the "modules" directory in the project structure?

Upvotes: 3

Views: 788

Answers (1)

Rene Groeschke
Rene Groeschke

Reputation: 28653

you can do this by manipulating the settings.gradle file. you have to manually configure the location of your ":A" settings.gradle file:

project(":A").projectDir = new File(settingsDir, "modules/A")

you can also do this more generic by iterating over all subprojects

rootProject.children.each {project ->
....
}

Upvotes: 3

Related Questions