You can share test code between modules/projects easily using the Gradle java-test-fixtures
plugin.
plugins {
id("java-test-fixtures")
}
This will allow you to create a new source set in src/testFixtures
where you can define the test code you want to share with other modules.
In Gradle you can use these textFixtures easily with:
testImplementation(testFixtures("de.tschuehly:spring-view-component-core:0.7.3-SNAPSHOT"))
If you want to use these Gradle test fixtures in a maven project you need to add the dependency with the test-fixtures classifier:
<dependency>
<groupId>de.tschuehly</groupId>
<artifactId>spring-view-component-core</artifactId>
<version>${view.component.version}</version>
<classifier>test-fixtures</classifier>
</dependency>
If you want to learn more about HTMX + Spring Boot check out my series Web development without the JavaScript headache with Spring + HTMX.
My side business PhotoQuest is also built with HTMX + JTE