/
Using Java Agents - Generating a session ID

Using Java Agents - Generating a session ID

Before running the build scan and tests, you need to create a session ID. The session ID is provided for each step to link them together as one complete cycle.

 

Generating a session ID in Java

Generating a session ID in Java is done using the Java Build scanner with the -config flag and requires to specify a comma-separated list of packages composing the application.

java -jar sl-build-scanner.jar -config -tokenfile /path/to/sltoken.txt -appname "myApp" -branchname "master" -buildname "1" -pi "*com.company.*"

See 'Java Command Reference - Creating a session ID' for full parameter details

If you don’t know the list of packages of the application, please refer to our dedicated command described in a detailed documentation page.

The buildname parameter above should reflect a meaningful versioning of your service or application.
In some cases, you can use timestamps as well, via commands like `date +"%y%m%d_%H%M"` (Linux) or $(Get-Date -Format "yyyyMMdd_HHmm") (Powershell)

Using the session ID

The session ID will be printed to the console output and a file called 'buildSessionId.txt' will be generated containing it.

The file can be used as is in the different agents parameters or can be used to fill in an environment parameter to be in a command line.

Unix: export SL_BUILD_SESSION_ID=`cat buildSessionId.txt` Windows: set /p SL_BUILD_SESSION_ID=<buildSessionId.txt



Related content

SeaLights Java agent - Command Reference
SeaLights Java agent - Command Reference
More like this
Using Java Agents - Installing the Coverage Listener as a JVM Java Agent
Using Java Agents - Installing the Coverage Listener as a JVM Java Agent
More like this
Using Java Agents - Scanning a build
Using Java Agents - Scanning a build
More like this
Downloading the java agent files
Downloading the java agent files
Read with this
ANT build tool
ANT build tool
More like this
Using Java Agents - Running Tests
Using Java Agents - Running Tests
Read with this