Repositories based on environment profiles


I’m new with gradle outside Android ecosystem, and now I’m with Spring Boot 2 application.
I’m reading this tutorial about profiles ( and I want to use something similar for repository configuration but with no lucky.

I would like to have something like this:

    if (project.hasProperty('dev')) {
        apply from: rootProject.file('gradle/profile_dev.gradle')
    } else {
        apply from: rootProject.file('gradle/profile_pro.gradle')

on my build.gradle

profile_dev.gradle content is:

repositories {

But i’m getting this error when I execute this ./gradlew -Pdev bootRun

Cannot resolve external dependency org.springframework.boot:spring-boot-gradle-plugin:2.0.2.RELEASE because no repositories are defined.
Required by:
    project :

Any idea or even better solution?