I am trying to use AddCommentToMavenDependency
recipe to add a comment line inside a dependency declaration. But I think I am not able to provide the correct xpath, please correct.
recipeList:
- org.openrewrite.maven.AddCommentToMavenDependency:
xPath: /project/dependencies/dependency
groupId: com.myorg.exe
artifactId: exe-starter-parent
commentText: This is excluded due to CVE <X> and will be removed when we upgrade the next version is available.
Below is pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.myorg.exe</groupId>
<artifactId>exe-starter-parent</artifactId>
<version>5.0.24</version>
<relativePath />
</parent>
<groupId>com.myorg.exe.samples</groupId>
<artifactId>gooseberry-webclient-rest</artifactId>
<version>${app_version}</version>
<name>gooseberry-webclient-rest</name>
<description>A sample project demonstrating the service kernel usage for a REST API Server</description>
<properties>
<snakeyaml.version>2.0</snakeyaml.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<exclusions>
<exclusion>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
</exclusion>
</exclusions>
</dependency>
```
The AddCommentToMavenDependency adds a comment to a Maven dependency; in your example I don't see a Maven dependency matching the parameters that you've added. You might want to look at this example taken from the tests.