How do I add a dependency that is defined in an in...
# community-support
m
How do I add a dependency that is defined in an included build to my
settings.gradle.kts
buildscript classpath? I've tried this but it doesn't work:
Copy code
pluginManagement {
  includeBuild("my-build")
}

buildscript {
  dependencies {
    // com.example:artifact-id is built by the `my-build` included build
    // I was expecting dependency substitution to happen here but it doesn't look like it's the case?
    classpath("com.example:artifact-id")
  }
}
Is there a way?
t
Is this how you expect it to be used eventually? Otherwise create a plugin that brings this dependency, and apply it.
m
That's what I'd like to avoid
Feels weird that this only works for plugins
The plan is to use this for plugins that are otherwise applied in the different projects. I can define a fake settings plugins and
apply(false)
but that's adding a bunch of thing I'd rather avoid.
v
Feels weird that this only works for plugins
Why? The
includeBuild
is within
pluginManagement
, so would feel strange if it worked for anything besides plugins 😄
m
Yea but the whole classpath thing is working with jars
The current setup forces me to define a setting plugin that is never going to be used
v
The classpath yes, but the classpath does not look into the builds included for plugins
If there is any plugin in that artifact, you can use that with
apply false
even if it is a project plugin, as long as you do not actually apply it, there is no problem with the wrong type.
If not, you probably have to add a no-op settings plugin for which you then can also leave out the
apply false
if it anyway does to nothing.
m
even if it is a project plugin, as long as you do not actually apply it, there is no problem with the wrong type
TIL!
Yea, no-op settings plugin also works
Still feels weird IMO
v
Then make it non-no-op, but configure something 😄
m
Yeaaaa
This is mostly about "feelings" technically everything works
🐼 1
I'll just
apply(false)
the
Project
plugin in the
Settings
file and leave a nice comment
👌 1