0PricingLogin
Groovy & Gradle: JVM Automation and Build Engineering · Lesson

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'
    }
}

All lessons in this course

  1. Declaring Project Dependencies
  2. Dependency Resolution & Caching
  3. Custom Repositories & BOMs
  4. Resolving Version Conflicts & Dependency Constraints
← Back to Groovy & Gradle: JVM Automation and Build Engineering