Robert Elliot
02/24/2025, 10:15 AMautonomousapps.build-health
to help me with this and it works very well; I look very hard at any change to dependencies in build.gradle.kts
in each subproject and that, and the compiler, then force me to maintain architectural boundaries.
However, I'm ending up with a volume of subprojects containing very few source files that my fellow developers think is insane. Currently 19 gradle subprojects for 58 production source files.
I'm being pressed to switch to a single project and use ArchUnit to enforce the architectural boundaries, but I'm unenthusiastic because then you only find out about breakages when you run your tests. I want the compiler, and hence the IDE, to be telling me what I can and can't do.
Another option is to use multiple source sets in a single project, but I think this will still be viewed as overkill by my fellow devs.
I know it doesn't, but I'm wondering if Gradle could theoretically support multiple module-info.java
files in a single source set? Then I could collapse a lot of the projects into a single src/main/kotlin
directory, with module-info.java
files in each of the app
, core
, portN
, adapterN
packages that would control visibility?Robert Elliot
02/24/2025, 10:21 AMmy-project/
├─ app/
│ ├─ build.gradle.kts
│ ├─ src
│ ├─ main
│ ├─ kotlin
│ ├─ src
│ ├─ test
│ ├─ kotlin
├─ core/
│ ├─ build.gradle.kts
│ ├─ src
│ ├─ main
│ ├─ kotlin
│ ├─ src
│ ├─ test
│ ├─ kotlin
├─ dependency1/
│ ├─ api
│ ├─ build.gradle.kts
│ ├─ src
│ ├─ main
│ ├─ kotlin
│ ├─ src
│ ├─ test
│ ├─ kotlin
│ ├─ tech-specific-implementation
│ ├─ build.gradle.kts
│ ├─ src
│ ├─ main
│ ├─ kotlin
│ ├─ src
│ ├─ test
│ ├─ kotlin
├─ dependency2/
│ ├─ api
│ ├─ build.gradle.kts
│ ├─ src
│ ├─ main
│ ├─ kotlin
│ ├─ src
│ ├─ test
│ ├─ kotlin
│ ├─ tech-specific-implementation
│ ├─ build.gradle.kts
│ ├─ src
│ ├─ main
│ ├─ kotlin
│ ├─ src
│ ├─ test
│ ├─ kotlin
Robert Elliot
02/24/2025, 10:21 AMmy-project/
├─ the-app/
│ ├─ build.gradle.kts
│ ├─ src
│ ├─ main
│ ├─ kotlin
│ ├─ app/
│ ├─ module-info.java
│ ├─ core/
│ ├─ module-info.java
│ ├─ dependency1/
│ ├─ api/
│ ├─ module-info.java
│ ├─ tech-specific-implementation/
│ ├─ module-info.java
│ ├─ dependency2/
│ ├─ api/
│ ├─ module-info.java
│ ├─ tech-specific-implementation/
│ ├─ module-info.java
│ ├─ src
│ ├─ test
│ ├─ kotlin
│ ├─ app/
│ ├─ module-info.java
│ ├─ core/
│ ├─ module-info.java
│ ├─ dependency1/
│ ├─ api/
│ ├─ module-info.java
│ ├─ tech-specific-implementation/
│ ├─ module-info.java
│ ├─ dependency2/
│ ├─ api/
│ ├─ module-info.java
│ ├─ tech-specific-implementation/
│ ├─ module-info.java
Vampire
02/24/2025, 12:04 PMsrc/main/kotlin
, but I doubt your fellow devs would be any happier about it, and it would make the situation much less clear imho.
I would probably agree, that you should use different projects (or at least different source sets that are clearly separated).Robert Elliot
02/24/2025, 1:38 PMRobert Elliot
02/24/2025, 1:39 PMmodule-info.java
in a single compilation unit...Vampire
02/24/2025, 1:50 PMRobert Elliot
02/24/2025, 1:56 PM