Gradle: Managing scope and platform-specific dependencies

Omkar Birade
Nerd For Tech
Published in
5 min readApr 5, 2021

--

From mobile apps to micro-services, managing dependencies is one of the most crucial yet tedious tasks. Various build tools like gradle, maven, ant, grunt, etc exist to make us developers’ lives easy.

Gradle is one of the most popular such build tool with a focus on build automation and support for multi-language development. Linkedin, Netflix, etc all use gradle as their build tool.

The dependency labyrinth

source: https://solidsoft.wordpress.com/2016/06/07/gradle-tricks-display-buildscript-dependencies/

As the project size gets larger the number of dependencies increase. In distributed systems, this can quickly get out of hand. Managing dependencies itself is a formidable task let alone managing scope and platform-specific dependencies.

How do we manage so many dependencies? After all, we don’t need all of them to be packaged inside the prod build. Some of them are dev only, test specific etc which won’t be needed in the final jar.

This is where gradle steps in. Gradle makes this a little easier with something called configuration.

Configuration

Every dependency declared for a Gradle project applies to a specific scope. For example, some dependencies should be used for compiling source code whereas others only need to be available at runtime. Gradle represents the

--

--