Home > Software engineering >  Gradle: what are Dependencies?
Gradle: what are Dependencies?

Time:04-02

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?

CodePudding user response:

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")  
}  

CodePudding user response:

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.

  • Related