I've got a composite build with a convention plugi...
# community-support
b
I've got a composite build with a convention plugin; how do I reference files from that build? when using the project layout, it points to the project including the convention plugin
v
Imagine the convention plugin being a complete separate project published to some maven repository. So have the files as normal resources and access them through the classloader.
b
you don't recommend doing things like project.file("../build-logic/detekt.yml") correct?
I'm unsure if that will work if I was going to use multi project builds
v
I would not do that, no. What you could do is put it somewhere in your root project and in the convention plugin use that file no matter to which project it is applied.
b
as for the classloader approach: are all resource folders merged together in composite builds?
like, do I need to do something like: build-logic/detekt.yml?
v
Dunno what you mean by "all resource folders". Composite builds are not special, they are simply a separate build running first automatically if necessary.
It is just a normal resource. If you have it at
src/main/resources/foo/bar/detekt.yml
, then it is in the classpath of your plugin at
foo/bar/detekt.yml
just like usual.
b
right, but if the build including the composite build also has the same file at the exact location in its resources folder, will it be overridden?
v
If you have your main project that includes your build logic project, then what you have as resource in your main project is irrelevant, because that are resources for your project at runtime and irrelevant for classpath of you build logic.
b
ah, thank you, that clears things up
👌 1