# Update Parent POM File

### Problem: <a href="#problem" id="problem"></a>

When a maven project contains one or multiple parent POM files which update the `argLine` of the Surefire or the Failsafe plugin, you will need to update the parent POM file as well as the project POM.

### Solution: <a href="#solution" id="solution"></a>

2 flags need to be added to the `-pom` command:

1. `modifyParentPom true` - Enable the feature
2. `mavenLocalRepoPath /path/to/m2/repository` - Provide the path of the .m2 folder’s repository

There are 3 different scenarios:

1. If the project POM file has a relativePath in the \<parent> section - it will update this file
2. If no relativePath, it will search for a pom.xml file in the parent folder and update this file
3. If no pom.xml file in the parent folder, it will search for it in the .m2 repository folder (under the `../repository/<groupId>/<artifactId>/<version>/<artifactId>-<versionId>.pom`)

### Example: <a href="#example" id="example"></a>

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

```
java -jar sl-build-scanner.jar -pom -configfile slmaven.json -workspacepath . -mavenLocalRepoPath /Users/Tests/.m2/repository -modifyParentPom true
```

{% endcode %}


---

# 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/troubleshooting-faq/maven/update-parent-pom-file.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.
