I am getting confused, please someone correct me
From Gradle plugin portal it says use below approach to add a plugin
-------Using the plugins DSL:--------------------
plugins {
id "com.github.edeandrea.xjc-generation" version "1.4"
}
-------Using legacy plugin application:--------
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.com.github.edeandrea:xjc-generation-gradle-plugin:1.4"
}
}
apply plugin: "com.github.edeandrea.xjc-generation"
The legacy approach is pretty much clear: as per my understanding it will find that dependency in repositories (specified maven URL) and add it to the classpath so that the application can pick the specified plugin
But in case of new approach (i.e. using DSL) it doesn't say anything, what I understand is the plugin must be published in official Gradle repo in order to access it, but how the build.gradle files know where to find it, meaning do we need to add repositories {} block and specify mavencentral() in it to make it work or need to add anything else ?
Also pluginMangement block present in settings.gradle controls the new plugin approach, I have tried defining the repositories {} block and added mavencentral() but it doesn't work.
In short, how plugin added using DSL works, which block tells from where to find that plugin and then which line tells to add it in the classpath.
Updates:
For ex, the maven block in repositories-buildscript section tells to look the plugin under url "https://plugins.gradle.org/m2/ location and classpath tag in dependencies-buildscript tells to add this dependency into application classpath
Correction: mavenCentral()