Jonathan Olsson
03/19/2021, 11:15 AM# root/build.gradle:
buildscript {
repositories {
maven {
url "$url"
credentials { ... }
}
}
dependencies {
classpath "my.org.foo:my-plugin:$version"
}
}
And then I could simply:
apply plugin: 'my.org.foo'
Now I try to replace this by what appears to be the "modern" approach:
# root/settings.gradle
pluginManagement {
repositories {
maven {
url "$url"
credentials { ... }
}
}
}
# root/subModule/build.gradle
plugins {
id 'my.org.foo' version '...'
}
Now, when doing this gradle tries to resolve this to 'my.org.foo:my.org.foo.gradle.plugin:$version'
.
How do I make gradle understand how to locate the proper artifact? Thanks!tapchicoma
03/19/2021, 11:29 AMpluginManagment
in settings.gradle.kts
, for example for android plugin:
pluginManagement {
repositories {
gradlePluginPortal()
google()
}
resolutionStrategy {
eachPlugin {
when (requested.id.id) {
"com.android.application" ->
useModule("com.android.tools.build:gradle:${requested.version}")
}
}
}
}
Jonathan Olsson
03/19/2021, 11:39 AMtapchicoma
03/19/2021, 11:45 AMbuildSrc/build.gradle.kts
old way 🤷♂️Vampire
03/19/2021, 3:03 PMplugins
block would be unnecessary clutter as you then need to specify it on every usage instead of one time centrally.
The marker artifacts are the default way how a plugin id is translated to the actual dependency. Imagine you have an artifact my-plugins.jar
that contains the plugins my-a
, my-b
and my-c
.
Then you will have three "marker artifacts" that follow the naming convention you have seen and then depend on the my-plugins.jar
.Jonathan Olsson
03/19/2021, 9:04 PMJonathan Olsson
03/19/2021, 10:01 PM