How to only build and cache modified dependencies without completely building?


(Alireza) #1

Hi,

Building over and over just because of a modified dependency is so annoying. Building completely takes sometimes 1 hour for me! I always enable the offline mode option but for building with modified dependencies I must disable that but the time it takes is very very annoying. The only solution I found is I must learn how to only build and cache the modified dependencies.

Please help me with this, thanks,
Alireza


(Csaba Sulyok) #2

Hi alireza,

You could create a gradle task which only iterates through dependencies, this would make sure gradle resolves them.
Something like in this thread: How to get absolute path of a file declared in dependencies?

You don’t even have to print them, just make sure to iterate through the list.
Is this similar to what you are looking for?

Good luck,
Csaba


(Stefan Oehme) #3

What takes one hour? An incremental build? Have you run gradle build --profile and looked where the time is spent?

I don’t know what you mean by that. What kind of projects are you building? Java? What kind of dependencies are we talking about?

You need to provide more input so people can understand your problem and help you.