# Command Reference

## Build Scanner <a href="#build-scanner" id="build-scanner"></a>

### Integrating into the pom.xml files <a href="#integrating-into-the-pom.xml-files" id="integrating-into-the-pom.xml-files"></a>

{% code overflow="wrap" lineNumbers="true" %}

```
java -jar sl-build-scanner.jar -pom -configfile <arg> -workspacepath <arg> [-pluginversion <arg>]
```

{% endcode %}

<table><thead><tr><th width="149.9765625">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>configfile</code></td><td>The path to the JSON configuration you created with the parameters to be provided to the SeaLights Maven Plugin</td></tr><tr><td><code>workspacepath</code></td><td>The base path to the location of the pom.xml files to update</td></tr><tr><td><code>pluginversion</code></td><td>(<em>Optional</em>) Version of the Maven SeaLights Plugin to insert into the pom.xml</td></tr></tbody></table>

### Restoring the pom.xml file to its previous state <a href="#restoring-the-pom.xml-file-to-its-previous-state" id="restoring-the-pom.xml-file-to-its-previous-state"></a>

{% code overflow="wrap" lineNumbers="true" %}

```
java -jar sl-build-scanner.jar -restorePom -workspacepath <arg>
```

{% endcode %}

<table><thead><tr><th width="164.39453125">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>workspacepath</code></td><td>The base path to the location of the pom.xml files to update</td></tr></tbody></table>

## Maven tool <a href="#maven-tool" id="maven-tool"></a>

### Command line flags passed to Sealights maven plugin <a href="#command-line-flags-passed-to-sealights-maven-plugin" id="command-line-flags-passed-to-sealights-maven-plugin"></a>

{% code overflow="wrap" lineNumbers="true" %}

```
mvn <arg> [{-DrunTestsOnly=<arg> | -DrunFunctionalTests=<arg>}] [-Dsl.modulesToSkip=<arg>]
```

{% endcode %}

<table><thead><tr><th width="184.33203125">Parameter</th><th width="94.6953125">Default</th><th>Description</th></tr></thead><tbody><tr><td><code>runTestsOnly</code></td><td>false</td><td>Set to true to skip build-scanner<br>Note: when working with the Jenkins plugin this flag will not work, and you should use the runFunctionalTests=true</td></tr><tr><td><code>runFunctionalTests</code></td><td>false</td><td>(<em>Deprecated</em>: prefer including this flag in your JSON config file instead)<br>Set to true to skip build-scanner and only validate partially build session data (for example packages included are not mandatory)</td></tr><tr><td><code>sl.modulesToSkip</code></td><td></td><td><em>(Optional)</em> A comma separated list of modules to skip.</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

{% hint style="info" %}
See all of the parameters that can be passed via the JSON configuration file:

* [Scanning Builds](/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/java-build-tools-plugins/sealights-maven-plugin/scanning-builds.md#json-configuration-parameters-reference)
* [Running Tests (Only)](/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/java-build-tools-plugins/sealights-maven-plugin/running-tests-only.md#configuring-the-sealights-maven-plugin-using-a-json-file)
  {% endhint %}

## JSON Configuration file parameters <a href="#json-configuration-parameters-reference" id="json-configuration-parameters-reference"></a>

Create a JSON configuration file with the following parameters to provide the necessary configuration fields to the SeaLights Maven plugin:

1. **configuration** section with the following parameters
   1. **token** or **tokenFile** - set with a token or a file containing the token obtained from the SeaLights dashboard
   2. If you create a Build Session ID externally, provide the following fields:
      1. **buildSessionId** or **buildSessionIdFile** - Set with a build session id or a file containing the build session id created by the config step
      2. **createBuildSessionId** - Set to **false**
   3. If you want to create a Build Session ID using the SeaLights Maven plugin, provide the following fields:
      1. **createBuildSessionId** - Set to **true**
      2. **appName** - Name of the application as you want to see it on the SeaLights dashboard
      3. **branchName** - Name of the branch as you want to see it on the SeaLights dashboard
      4. **buildName** - Name of the build as you want to see it on the SeaLights dashboard
      5. **packagesIncluded** - Comma-separated list of packages to include in scan. Note: This is defining a subset, so it must include the asterisk to include all sub packages/classes
      6. **packagesExcluded** - (Optional) Comma-separated list of packages to include in scan. Note: This is defining a subset, so it must include the asterisk to include all sub packages/classes
   4. If you want to create a Pull Request Build Session ID using the SeaLights Maven plugin, provide the following fields:
      1. **createPRBuildSessionId** - Set to **true**
      2. **appName** - Name of the application as you want to see it on the SeaLights dashboard
      3. **targetBranch** - The branch to which this PR will be merged into (already reported to SeaLights)
      4. **pullRequestNumber** - The number assigned to the Pull Request from the source control
      5. **latestCommit** - The full SHA of the last commit made to the Pull Request
      6. **repositoryUrl** - The pull request URL for the PR to be scanned, up until the section before the pullRequestNumber value
      7. **packagesIncluded** - Comma-separated list of packages to include in scan. Note: This is defining a subset, so it must include the asterisk to include all sub packages/classes
      8. **packagesExcluded** - (Optional) Comma-separated list of packages to include in scan. Note: This is defining a subset, so it must include the asterisk to include all sub packages/classes
   5. **executionType** - Provide which executions need to handled by the Maven plugin
      1. **full** - Execute both the build scanner and the test listener
      2. **testsonly** - Execute only the test listener
      3. **scanonly** - Execute only the build scanner
   6. **filesincluded** - (Optional) Set to the binary files to scan. Default: `*.class`
   7. **filesexcluded** - (Optional) Set to the binary files to excluded from the scan. Default:`*test-classes*`
   8. **workspacepath** - Set to with the path to the binary files to scan (Different per module). Default: `${project.build.outputDirectory}`\
      Note: there are rare cases that this needs to be changed. Make sure you really need to change it before doing so.
   9. **moduleNameArtifactId** - (Optional) Set to true to set automatically the module name for each sub-project to be based on `${project.artifactId}`. Default: false.
   10. **recursive** - (Optional) Set to true to scan all the subdirectories of workspacepath. Default: `true`
   11. **includeResources** - (Optional) Set to include the token and build session ID files in the built resources
   12. **includeTokenResource** - (Optional) On top of `includeResources` above, set to `false` to exclude the token file from the built resources. By default is `true`.
   13. **testStage** - (Optional) Set the name of the test stage as will be displayed on the SeaLights dashboard
   14. **labId** - (Optional) Unique ID for a set of test labs in case multiple labs are running simultaneously
   15. **filesStorage** - Set to the temp folder for the agent to create temporary files in. For example: `/tmp` or `C:\\Temp`
   16. **logEnabled** - Set to **true** if you want a log to be created
   17. **logLevel** - Set the log level to create. For example: `INFO`
   18. **proxy** - (Optional) Address of proxy to run connection through
   19. **sealightsJvmParams** - Entry to provide JVM params to the SeaLights agent. It should be of the format `{"key1":"val1", "key2":"val2"}`
   20. **metadata** section with CI details
       1. **jobName** - Set to the name of the build job. For example: `${JOB_NAME}`
       2. **logsUrl** - Set to the link that the SeaLights dashboard should provide to view the build log. For example: `${BUILD_URL}/console`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sealights.io/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/java-build-tools-plugins/sealights-maven-plugin/command-reference.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
