Capturing Unit Tests (UT) with the SeaLights Maven Plugin — Delta Guide
This page lists only the extra settings vs. the base “Scanning Builds” flow. If you can already scan builds, add the changes below to also capture UT.
What changes vs. scan-only?
executionType
Set to
full(instead ofscanonly). This injects both the Build Scanner and the Test Listener (Surefire/Failsafe).
testStage (optional)
Default stage label is
Unit Tests.If you want a different label (e.g., “UT – Fast”, “UT CI”), set
"testStage": "<your-name>".
Surefire/Failsafe argLine merge
If your POMs already set
<argLine>…</argLine>, keep your content and append SeaLights’ variable:Surefire:
@{sealightsArgLine}(or override viasurefireArgLine)Failsafe:
@{sealightsArgLine}(or override viafailsafeArgLine)
If you don’t touch argLine yourself, the plugin wires it automatically.
Listener/Scanner jars (if pre-downloading)
If you pin artifact paths, provide both:
scannerJarandlistenerJar.
(Optional) labId / tags / metadata
Use when you want to group or filter test runs (e.g., multiple suites in parallel).
Configuration file
Minimal JSON snippet (delta only)
{
"executionType": "full",
"testStage": "Unit Tests" // change if you want a custom label
}Keep all your existing base fields from the “Scanning Builds” doc (token/BSID/app/branch/packages, etc.).
Recommended full JSON (compact but complete)
Start from your scanning JSON and add the bolded fields.
{
"executionType": "full",
"tokenFile": "sltoken.txt",
"createBuildSessionId": true,
"appName": "${JOB_NAME}",
"branchName": "${GIT_BRANCH}",
"buildName": "${BUILD_NUMBER}",
"packagesIncluded": "*com.example.*",
"packagesExcluded": "",
"filesIncluded": "*.class",
"filesExcluded": "*test-classes*",
"recursive": true,
"includeResources": true,
"logEnabled": false,
"logDestination": "console",
"logLevel": "off",
"logFolder": "/tmp",
"sealightsJvmParams": {}
}Frequently used parameters
Surefire and Failsafe argLine update
If you have configured the argLine for surefire and/or failsafe, the integration will include adding @{sealightsArgLine} to them.
This can be updated/overridden by adding and updating the following parameters to the JSON file:
surefireArgLine - Whatever is defined here will be updated in the argLine of surefire if it exists. By default
@{sealightsArgLine}failsafeArgLine - Whatever is defined here will be updated in the argLine of failsafe if it exists. By default
@{sealightsArgLine} -Dsl.testStage="Integration Tests"
Sample of Surefire and Failsafe argLine update
"surefireArgLine": "-Xms1280m -Xmx1280m @{sealightsArgLine}"
"failsafeArgLine": "-Xmx8192m @{sealightsArgLine} -Dsl.testStage=\"Integration Tests\""Tagging
You can add tags to be viewed in the cockpit for the agents started by this maven job by passing them through the sl.tags property in the sealightsJvmParams field
"sealightsJvmParams": {
"sl.tags": "ci,unittest",
}Sample script
echo "Downloading Sealights Agents..."
wget -nv https://agents.sealights.co/sealights-java/sealights-java-latest.zip
unzip -o sealights-java-latest.zip
echo "Sealights agent version used is:" `cat sealights-java-version.txt`
echo '{
"executionType": "full",
"tokenFile": "./sltoken.txt",
"createBuildSessionId": true,
"appName": "${JOB_NAME}",
"branchName": "${GIT_BRANCH}",
"buildName": "SL_Timestamp",
"packagesIncluded": "*com.example.*",
"includeResources": true,
"logEnabled": false,
"logDestination": "console",
"logLevel": "warn"
}' > slmaven.json
echo "Updating POM with Sealights..."
java -jar sl-build-scanner.jar -pom -configfile slmaven.json -workspacepath .Next step is to run your regular maven command typicall like 'mvn clean install' or 'mvn clean verify' for example.
Last updated
Was this helpful?

