All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bmuschko.gradle.docker.RepositoriesFallbackPlugin.groovy Maven / Gradle / Ivy

There is a newer version: 6.7.0
Show newest version
package com.bmuschko.gradle.docker

import groovy.transform.CompileStatic
import org.gradle.api.Plugin
import org.gradle.api.Project

@CompileStatic
class RepositoriesFallbackPlugin implements Plugin {
    @Override
    void apply(Project project) {
        // if no repositories were defined fallback to buildscript
        // repositories to resolve dependencies as a last resort
        project.afterEvaluate {
            if (project.repositories.size() == 0) {
                project.repositories.addAll(project.buildscript.repositories.collect())
            }

            // if still 0 attempt to grab rootProject buildscript repos
            if (project.repositories.size() == 0) {
                project.repositories.addAll(project.rootProject.buildscript.repositories.collect())
            }

            // and if still 0 attempt to grab rootProject repos
            if (project.repositories.size() == 0) {
                project.repositories.addAll(project.rootProject.repositories.collect())
            }
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy