Maven Plugin
The Paramixel Maven plugin discovers and executes @Paramixel.Factory methods during the test phase.
Setup
<build>
<plugins>
<plugin>
<groupId>org.paramixel</groupId>
<artifactId>maven-plugin</artifactId>
<version>5.0.0</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Plugin parameters
| Parameter | Property | Default | Description |
|---|---|---|---|
skipTests | paramixel.skipTests | false | Skip Paramixel test execution |
failIfNoTests | paramixel.failIfNoTests | false | Fail when no action factories are discovered |
failureOnSkip | paramixel.failureOnSkip | false | Treat SKIPPED results as failures |
failureOnAbort | paramixel.failureOnAbort | true | Treat ABORTED results as failures |
reportFile | paramixel.report.file | (none) | Path to the per-run summary report |
matchPackage | paramixel.match.package.regex | (none) | Regex for filtering discovered action factories by package name |
matchClass | paramixel.match.class.regex | (none) | Regex for filtering discovered action factories by fully qualified class name |
matchTag | paramixel.match.tag.regex | (none) | Regex for filtering discovered action factories by @Paramixel.Tag value |
properties | — | — | Additional Paramixel configuration properties |
strictThreadLifecycle | paramixel.strictThreadLifecycle | false | Fail when non-daemon threads linger after execution whose context classloader is a URLClassLoader |
Configuration precedence
- Test-classpath
paramixel.propertiesand built-in defaults (lowest) - Plugin
<properties>in the POM - Plugin
<reportFile>,<failureOnSkip>,<failureOnAbort>,<failIfNoTests>parameters -Dparamixel.*system properties (highest)
System properties always win over POM properties and plugin parameters when both set the same key.
Custom properties
<configuration>
<properties>
<property>
<key>paramixel.parallelism</key>
<value>4</value>
</property>
</properties>
</configuration>
CLI overrides
# Skip tests
./mvnw test -Dparamixel.skipTests=true
# Fail when no tests found
./mvnw test -Dparamixel.failIfNoTests=true
# Generate a report
./mvnw test -Dparamixel.report.file=target/paramixel/report.json
# Filter by tag
./mvnw test -Dparamixel.match.tag.regex=smoke
# Set parallelism
./mvnw test -Dparamixel.parallelism=8
How it works
- Builds a
URLClassLoaderfrom the project's test classpath - Sets the thread context classloader to the test classloader
- Resolves action factories using the runner's internal classpath scanner
- Executes discovered actions with
Runner - Restores the original classloader
- Checks for lingering non-daemon threads whose context classloader is a
URLClassLoader(warns or fails depending onstrictThreadLifecycle)
Build failure conditions
The Maven build fails when the root action result is:
FAILEDPENDINGSKIPPED(whenfailureOnSkip=true)ABORTED(whenfailureOnAbort=true, which is the default)
Skipping JUnit tests
The Paramixel Maven plugin is independent of Surefire. Use -DskipTests to skip Surefire JUnit tests and -Dparamixel.skipTests to skip Paramixel tests. They are independent flags.
To skip all tests:
./mvnw test -DskipTests -Dparamixel.skipTests