I have a project with multiple modules in there an...
# community-support
a
I have a project with multiple modules in there and a separate plugin module. However, now I want to share some domain objects between the normal modules and the plugin. However, I unable to make it work. In short: • core module (my main app module) • domain module (simple data classes) • plugin module (Gradle Plugin) My root settings.gradle.kts looks like this:
Copy code
includeBuild("plugin")

include("domain")
include("core")
This works splendid at least when I am not requiring the
domain
module in
plugin
. So I decided to add
include('domain')
also in
plugin/settings.gradle.kts
and this doesn't complain. But I am unable to add it as a dependency in
plugin/build.gradle.kts
. It is unable to find it: `
Copy code
implementation(project(":domain"))
I tried every combination with colons btw.... My idea was that
includeBuild
is in fact a completely separate 'build' and as such is able to add its own modules again. In my Gradle hierarchy in the right bar in IntelliJ it does show that
domain
is added both to
core
and
plugin
as a submodule.
Okay, I got it compiling now, and I can add the dependency. But now I am unable to add the data-classes in the code. IntelliJ keeps complaining that the references don't exist. When I add manual imports it compiles however.
I think my solution is in composite builds: https://docs.gradle.org/current/userguide/composite_builds.html I need to learn those more, because I am doing them already, but not understanding them.
And it works. So this was a nice monologue 😄