A very simple question I think. I have a project c...
# community-support
a
A very simple question I think. I have a project consisting of the following folders: • libraries ◦ libA ◦ libB • plugins ◦ pluginA ◦ pluginB • applications ◦ appA ◦ appB Plugins should be able to have dependencies on libraries Applications should be able to have dependencies on libraries and enable plugins from the plugins Am I correct that composite builds at the level of libraries/plugins/applications is the right way forward? If I wouldn't have the plugins I could've gone the simpler route of just including the subprojects. But since plugins need to be available during the configuration phase (correct?) they needed to be included in the build and this automatically implies that its dependencies as well need to be available in the build.
v
Yes, sounds correct.
❤️ 1
a
The typesafe project accessors don't work properly between composite builds it appears though. The group names of the included builds are overwritten with these of the 'current' build. E.g.: in applications I want to use
projects.libs.libA
but that group name is now
org.my.apps
instead of
org.my.libs
.
v
Sounds like you did not use composite build, but included libA in mutliple builds. Never ever ever ever ever ever ever ever ever ever even try to do that.
There will be no project accessors for projects in other builds, they are projects in other builds
You depend on the normal coordinates of these artifacts
👍 1
a
I do use composite builds in the root project. However, I had an old leftover includeBuild in one of the other builds. Why are we never ever ever ever ever ever ever allowed to do that?
v
includeBuild
is fine, that is composite build
But you must never
include
one project into multiple builds, that will just make you veeery unhappy quite fast.
a
Oh yeah. But i did not do that
v
One project should always be dedicated to exactly one build
And if you need it somewhere else, you use a composite build
But if you did not include the project, you should not even have a project accessor
That's why I assumed you did
a
About the project accessor.... it went away when I cleaned the generated Gradle code and reimported my project. I suppose that it was leftover cache somehow.
👌 1
So let me get this straight. In the root project I can do:
Copy code
includeBuild("libs")
includeBuild("plugins")
includeBuild("apps")
And now it works. Or is it better to explicitly use
includeBuild
, for instance. In apps:
includeBuild("../libs")
?
v
Just like with dependencies I would use the
includeBuild
where you use it. Then you can for example also open just
apps
in the IDE and get apps and libs open.
Also, projects contributing build logic should be included within
pluginManagement
, builds contributing normal dependencies (in the context of the includeing project) outside, builds that contribute both, in both places. So
apps
to
plugins
within
pluginManagement
,
plugins
and
apps
to libs outside.