Vic Seedoubleyew
Vic Seedoubleyew

Reputation: 10526

Add repository from Gradle plugin

I am writing a Gradle plugin, and I would like it to add repositories to the project.

How can I do so?

Upvotes: 3

Views: 1556

Answers (1)

Vic Seedoubleyew
Vic Seedoubleyew

Reputation: 10526

Inside the apply method of your Plugin<Project> class, add the following:

  • for Maven Central: project.repositories.mavenCentral()
  • for Google Maven: project.repositories.maven()

More generally, call any function that you would place in the repositories section of your build script from project.repositories.

You can find entire list of such functions here: https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.dsl.RepositoryHandler.html

Upvotes: 4

Related Questions