How do I set up such a project structure where I have the root project called "app", "frontend" and "backend" project inside and a count of library projects inside each. Then run a build task that would give me one backend jar and a swing (for example) jar application.
Like this:
then run: gradle build
and have build/.../frontend.jar
and build/.../backend.jar
I did try using include
inside settings.gradle
but that doesn't seem to work (at least gradle projects
and intellij idea do not recognise the projects inside frontend
and backend
). I had:
root/settings.gradle
with: include 'frontend', 'backend'
root/backend/settings.gradle
with: include 'library', 'main'
and the same for frontend
In modern Gradle it's possible to includeBuild
, which solves the problem perfeclty:
// root/settings.gradle.kts
rootProject.name = "root"
includeBuild("backend")
includeBuild("frontend")
// root/backend/settings.gradle.kts and root/frontend/settings.gradle.kts
include(":library")
include(":main")