Learning gradle, it seems to be a build tool for Java. But i'm confused to what dependencies really is. What do dependencies section in Gradle really mean? What purpose does it serves?
Your software depends on other software
A dependency is simply a piece of software that you want to call from your own code. So, your software depends on that other software.
A transitive dependency is yet another piece of software used by one of your dependencies. So, your software depends on some other software that depends on some other software.
You simply tell Gradle what software you want to call upon. Gradle takes care of locating a copy of that software in a Maven repository (a centralized catalog of publicly available software), downloading a copy across the Internet, and making that downloaded copy available to your own code in your project. Gradle also takes care of determining transitive libraries that are needed by the libraries you need. Those get downloaded for you as well.
ππ½ Using Gradle saves you the trouble of manually locating and copying the needed software yourself.
As a build automation tool, Gradle manages your software dependencies as part of its duties. Gradle also compiles your code, and packages your compiled code into an artifact such as a JAR file or WAR file.
You may browse a Maven repository to see the millions of available pieces of software.
By the way, Maven is both a dependency management tool and a build automation tool. Maven has been quite successful at both. However, Gradle has been growing in popularity as an alternative build automation tool. For its dependency management part, Gradle leverages existing Maven repositories rather than re-inventing the wheel.
Gradle dependencies allow you to include extern packages in your project. This makes using other code very easy.
See more here: https://docs.gradle.org/current/userguide/declaring_dependencies.html
Example: If you want to include a JDBC driver to access databases, it would be very laborious if you would have to include the package by hand. Including this line in gradle allows you to add the package really easily to your project.
dependencies {
compile ("com.oracle:ojdbc7:12.1.0.1")
}
Your software depends on other software
A dependency is simply a piece of software that you want to call from your own code. So, your software depends on that other software.
A transitive dependency is yet another piece of software used by one of your dependencies. So, your software depends on some other software that depends on some other software.
You simply tell Gradle what software you want to call upon. Gradle takes care of locating a copy of that software in a Maven repository (a centralized catalog of publicly available software), downloading a copy across the Internet, and making that downloaded copy available to your own code in your project. Gradle also takes care of determining transitive libraries that are needed by the libraries you need. Those get downloaded for you as well.
ππ½ Using Gradle saves you the trouble of manually locating and copying the needed software yourself.
As a build automation tool, Gradle manages your software dependencies as part of its duties. Gradle also compiles your code, and packages your compiled code into an artifact such as a JAR file or WAR file.
You may browse a Maven repository to see the millions of available pieces of software.
By the way, Maven is both a dependency management tool and a build automation tool. Maven has been quite successful at both. However, Gradle has been growing in popularity as an alternative build automation tool. For its dependency management part, Gradle leverages existing Maven repositories rather than re-inventing the wheel.
This is the terminology used, for example, in npmjs.org for all the packages they host, but that terminology applies the same in this context.
For the express package, you'll see in their package page:
SIDE NOTE: "dependant" is for UK, and "dependent" is for US.
So, express
has:
- 31 dependencies, and
- 94,342 dependents
This information explains in this context who depends on whom. In the case of express
(popular, low-level of abstraction and old package), it is expected that it will depends on less packages, and that other numerous projects will depend on it.
For better graphically understanding what we see:
We see here a "software dependency", where the dependents depend on a external package/software to work (the so called "dependency").
© 2022 - 2024 β McMap. All rights reserved.