-
Notifications
You must be signed in to change notification settings - Fork 168
Description
I'm encountering an unexpected issue where com.tngtech.archunit:archunit
is included in my runtime classpath, even though I'm not using spring-modulith-runtime and I only depend on spring-modulith-starter-core.
Problem
I'm building a JavaFX application with Spring Boot and Spring Modulith. My build.gradle.kts
includes:
implementation("org.springframework.modulith:spring-modulith-starter-core")
implementation("org.springframework.modulith:spring-modulith-starter-jdbc")
// This is a local repo, patched to work with SQLite with Spring Data JDBC.
implementation("org.springframework.modulith:spring-modulith-events-jdbc:1.4.2-SNAPSHOT")
testImplementation("org.springframework.modulith:spring-modulith-starter-test")
testImplementation("org.springframework.modulith:spring-modulith-docs")
However, ArchUnit ends up in the compiled application's classpath, which bloats the final artifact and is unused at runtime. I am using jpackage to bundle the app image, which adds the ArchUnit jar to the custom runtime it generates.
Investigation
Running
./gradlew dependencyInsight --dependency archunit --configuration runtimeClasspath
Yields
com.tngtech.archunit:archunit:1.4.1
\--- org.springframework.modulith:spring-modulith-core:1.4.1
\--- org.springframework.modulith:spring-modulith-starter-core:1.4.1
+--- runtimeClasspath (requested org.springframework.modulith:spring-modulith-starter-core)
\--- org.springframework.modulith:spring-modulith-starter-jdbc:1.4.1
\--- runtimeClasspath (requested org.springframework.modulith:spring-modulith-starter-jdbc)
This shows that spring-modulith-core
, and spring-modulith-starter-jdbc
includes ArchUnit directly in compile/runtime scope, even though ArchUnit is meant for architectural tests only.
Workaround
I'm currently excluding ArchUnit manually in my Gradle config from spring-modulith-starter-core
and spring-modulith-starter-jdbc
.
Apologies if this is actually an expected behaviour.
Thanks.