Fixing classpath conflicts in tests
By default, expanders-assert checks for conflicts in the classpath before running tests. If one of the expansion-resources in the classpath depends on a newer version of a resource than what is available in the classpath, it throws an exception.
This check has been added because these kind of conflicts often created unexpected and hard to trace errors. By failing early, we send the developer in the right direction of updating their dependencies. However, due to how resolution works in maven, this can easily break builds of automated update mechanisms.
To make the builds less brittle, there is a new configure-test-classpath goal in the expanders-maven-plugin.
It updates the artifacts used to run tests to the latest version required by the expansion-resource dependencies.
By updating these artifacts, the classpath will be closer to what it will be during expansion.
To use this fix in a project, add an execution to expanders-maven-plugin in the pom.xml.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.normalizedsystems</groupId>
<artifactId>my-expanders</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>net.democritus.maven.plugins</groupId>
<artifactId>expanders-maven-plugin</artifactId>
<version>2025.4.0</version>
<executions>
<execution>
<id>expansion-resource</id>
<goals>
<goal>expansionResource</goal>
</goals>
</execution>
<execution>
<id>fix-test-classpath</id>
<goals>
<goal>configure-test-classpath</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
For a multi-module maven project, you can add this to the root module. (Just don't accidentally configure it in pluginManagement)
When updating artifacts, the plugin will still print warnings. The intent is to have developers manage their dependencies correctly, yet not obstruct them in updating single dependencies.

