# Sealights Maven Plugin

The **SeaLights Maven plugin** is designed to wrap the entire process (Build Scan + Test Listener functions) into the Maven lifecycle, allowing **seamless integration with the build tool**.

This solution uses the build scanner .jar file as well as a JSON configuration file. Once the jar is executed specifying the configuration file, the pom.xml files of the Maven project are altered to incorporate the SeaLights plugin. This can be reversed using another CLI command. Please refer to the dedicated page [Scanning Builds](/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/java-build-tools-plugins/sealights-maven-plugin/scanning-builds.md) to proceed with the integration.

Sealights Maven plugin operates during specific [Maven lifecycle](https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#lifecycle-reference) phases:

* Build Scanner is executed during `process-classes`
* Tests executed during the `test` phase are captured

The option `IncludeResources` will add the Sealights' text files (`sltoken` and `buildSessionId`) to the `target/classes` folder during `process-classes`. These two text files will be added automatically to the artefact (`.jar`, `.war`,...) during the package phase as they're already placed in the relevant folder.

<figure><img src="/files/z6EalTk7fBnpqUmi9eSZ" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
The following versions are the **minimum required** for integration with Maven test runners:

**Surefire** - version 2.8 and above, recommended is 2.22.2 and above.
{% endhint %}

{% hint style="info" %}
In addition to the ‘automatic update of POM file', we have kept backward compatibility of integrating Sealights plugin with your Maven build manually as described in [Legacy - Defining a Sealights profile in the pom.xml file](https://sealights.atlassian.net/wiki/spaces/SUP/pages/8073627/Maven+build+tool+-+Sealights+plugin).\
This solution requires manually editing your project’s pom.xml files and explicitly adding the Sealights plugin definition and settings. If you're onboarding a new application please avoid this method.
{% endhint %}


---

# 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.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.
