SeaLights Jenkins Plugin - Installing Test Listener as Java Agent

Agent Files

There are two agent files

  • Build Scanner - sl-build-scanner.jar

  • Test Listener - sl-test-listener.jar

Download them from:

The build scanning and running tests are handled by the SeaLights Jenkins plugin using Maven. Therefore In order to capture code coverage on your backend server, you need to only install our test listener as a Java agent on the backend server.

Session ID

The SeaLights CLI config step generates the session ID to be used, see SeaLights Jenkins plugin - Generating a session ID

Server startup command

The test  listener (sl-test-listener.jar) needs to be placed alongside the server and added to the JVM command line using the -javaagent parameter together with its required parameters.

Usually the easiest is to place it in the JAVA_OPTS="..." or similar environment variable that is used by your startup scripts, although it can also be placed in the JVM command itself.

  • If the artifact was packaged using the Include Resources option, then Test Listener will find the token and session ID inside it therefore you only need to pass the javaagent parameter:

  • If the artifact was not packaged using the Include Resources option, then the Test Listener needs to be provided the token and session ID as well:
-javaagent:/path/to/sl-test-listener.jar -Dsl.token=$SL_TOKEN -Dsl.buildSessionId=$SL_BUILD_SESSION_ID

JBoss & Wildfly

When the application server is JBoss or WildFly, you should also update the following parameters:

  • jboss.modules.system.pkgs=io.sealights
Sample Usage
JAVA_OPTS+="-javaagent:/path/to/sl-test-listener.jar -Dsl.token=$SL_TOKEN -Dsl.buildSessionId=$SL_BUILD_SESSION_ID -Djboss.modules.system.pkgs=org.jboss.byteman,io.sealights"

Spring boot maven plugin

When using the spring boot maven plugin, you can set the jvmArguments property in the configuration section of the plugin to define the needed arguments.

Note that if you are using the maven plugin you can use the ${sl.testListenerPath} instead of downloading and defining the actual test listener jar file.

Sample Usage
		<jvmArguments>-javaagent:${sl.testListenerPath} -Dsl.token=${SL_TOKEN} -Dsl.buildSessionId=${SL_BUILD_SESSION_ID}</jvmArguments>


Supported Jetty versions are: 9.1.1 and on

For the Jetty application server, if you are using the standard file then you can set the JAVA_OPTIONS environment variable with the javaagent, token and session ID.
Otherwise just add it to the JVM command you use to run jetty.

Sample Usage
export JAVA_OPTIONS="${JAVA_OPTIONS} -javaagent:/path/to/sl-test-listener.jar -Dsl.token=$SL_TOKEN -Dsl.buildSessionId=$SL_BUILD_SESSION_ID"

Gradle build file

When using gradle to bring up a JVM with your application, you can set the javaagent in the jvmArgs

Sample Usage
jvmArgs=["-javaagent:/path/to/sl-test-listener.jar", "-Dsl.token="+System.env.'SL_TOKEN', "-Dsl.buildSessionId="+System.env.'SL_BUILD_SESSION_ID']


In the admin console:

  • Go to Servers→Application servers
  • Select your server
  • Go to Configuration→Service Infrastructure→Java and Process Management→Process Definition→Additional Properties→Java Virtual Machine
  • Add the agent configurations in the Generic JVM arguments 
Sample Usage


In the admin console:

  • Go to Environments→Servers
  • Select your server
  • Go to Server Start
  • Add the agent configurations in the Arguments 
Sample Usage