How to use Gradle test fixtures in Maven via dependency

Thomas Schühly’s server-side rendering journey started as a developer trying to make life easier while developing his first bootstrapped product in his free time. Creating Spring ViewComponent enabled him to be the youngest Speaker at the largest European Spring conference and build awesome software full-time with his open-source library at alanda.io. He regularly talks at Java User Groups about htmx and server-side rendering with Spring while contributing to the open-source community. PhotoQuest
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




