Multi-project builds & gradle dependencies


(Tom Billiet) #1

I’ve the following project layout, it consists 3 subproject in 1 toplevel

  • Common: common library used for the 2 other projects * Java: the java version of the application * Android: the android version of the application.

Now this works fine, references can be made from one project to another.

However the “problem” I see is that some developers only work on java, while other only work on android. Unfortunately if you go to the java folder (hence not the root) and you do a “gradle assemble”, it processes all gradle scripts. This means also the ones from android.

This has some issues: 1. It’s slower to process all scripts, even the ones that are not needed 2. All android dependencies are downloaded (and that’s quite a lot), even you don’t need them 3. The android plugin requires the android sdk to be installed. That’s annoying if you’re only working on java.

Hence the question: how to tackle this? I’ve been trying to add some logic to the settings.gradle to only include the projects you really need, but I never came to an elegant solution.


(Peter Niederwieser) #2

You may want to give configuration on demand a try. I’m not sure if it will solve 2., though.


(Tom Billiet) #3

This seems exactly what I’m looking for! Did a quick test, and it also solves issue 2.

It seems I missed that part in the documentation, thanks for pointing it out.