Book Image

Gradle Dependency Management

By : Hubert Klein Ikkink
Book Image

Gradle Dependency Management

By: Hubert Klein Ikkink

Overview of this book

Table of Contents (14 chapters)
Gradle Dependency Management
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Declaring repositories


If we want to add dependencies from a repository in a Gradle build file, we must explicitly add the repositories configuration block. Within the configuration block, we define the location of the repository and maybe some extra configuration. In the following example of a build file, we define a Maven repository with a custom location:

// Repositories configuration block,
// must be present to define and
// configure repositories to get
// dependencies in our build script.
repositories {

  // Sample Maven repository with a
  // custom location.
  maven {
    url 'http://mycompany.net/maven'
  }

}

We can include several repositories in our build file. We can even mix the type of repositories, for example to, include both the Ivy repository and a local filesystem. Gradle supports the following types of repositories:

Type

Description

Maven JCenter repository

This is a preconfigured repository for Bintray JCenter

Maven central repository

This is a preconfigured repository...