Custom Repositories & BOMs
Configure custom Maven or Ivy repositories and use Bill of Materials (BOMs) for consistent dependency versions.
Beyond Maven Central
By default, Gradle looks for dependencies in Maven Central. But what if your dependencies aren't there?
Custom repositories allow you to fetch libraries from other locations, like:
- Your company's private artifact server.
- Specific public repositories (e.g., Google's Maven repo for Android).
- Local file system directories.
Adding a Maven Repository
To add a custom Maven repository, you declare it in the repositories block of your build.gradle file.
Gradle will check repositories in the order they are declared, stopping at the first match.
repositories {
mavenCentral()
maven {
url 'https://repo.spring.io/milestone'
}
}