# Maven

### How to replace a Maven package

1. Depending on your project's structure, replace the dependency version with the patched version:\
   In case it's a direct dependency, update the version property for the dependency section of the relevant `pom.xml` file (the example is `log4j@1.2.17`):

   ```xml
   <dependencies>
     ...
     <dependency>
       <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
       <version>1.2.17+sp2</version>
     </dependency>
     ...
   </dependencies>
   ```
2. In case it's a transitive dependency, update/add the following section in your project's `pom.xml` file, forcing the transitive dependency to use the sealed version:

   ```xml
   <dependencyManagement>
     <dependencies>
       <dependency>
         <groupId>log4j</groupId>
         <artifactId>log4j</artifactId>
         <version>1.2.17+sp2</version>
         ...
       </dependency>
       ...
     </dependencies>
     ...
   </dependencyManagement>
   ```
3. Purge existing dependency from the local repository and re-resolve them:

   ```bash
   mvn dependency:purge-local-repository -Dinclude="log4j:log4j" 
   ```


---

# 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.sealsecurity.io/fundamentals/artifact-server/editing-your-dependencies/maven.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.
