Select repository based on build environment

Is it possibly to use different repositories based on the build environment? I want to use one repository in the Continuous Build Environment, and a different one locally.

You can declare the repositories depending on a condition, determined by System property, environment variable, etc.

“testing.environment” is a System property in this example:

if (Boolean.getBoolean("testing.environment")) { 
    // Using repo for testing environment
    maven { url "https://internal.repo.com/m2/" }
} else {
    // Using repo for production environment
    maven { url "https://external.repo.org/m2/" }
}

Thanks! I didn’t realize I could have logic in there :slight_smile: