Michel Samia
Michel Samia

Reputation: 4487

How to use a mirror of gradle plugins to avoid using plugins.gradle.org

I want to download all dependencies from our company mirror, not from the public repo. How do I do it for gradle plugins?

Upvotes: 0

Views: 31

Answers (1)

Michel Samia
Michel Samia

Reputation: 4487

Put this into settings.gradle or settings.gradle.kts:

pluginManagement {
    repositories {
        val mavenUsername: String by settings
        val mavenPassword: String by settings
 
        // this replaces gradlePluginPortal()
        maven {
            credentials {
                username = mavenUsername
                password = mavenPassword
            }
            url = uri("https://your.corporate.repo/gradle-plugins")
        }
    }
}
 
rootProject.name = "someProject"

If your repo is not using authentication, you can remove the credentials and the variables. If your repo is using authentication, you need to put it into your ~/.gradle/gradle.properties:

mavenUsername=jdoe
mavenPassword=my_password_or_token

Upvotes: 0

Related Questions