I wrote an OpenRewrite recipe which changes Maven pom.xml
from containing this:
<dependency>
<groupId>a</groupId>
<artifactId>b</artifactId>
<version>1.0.0</version>
</dependency>
To this:
<dependency>
<groupId>c</groupId>
<artifactId>d</artifactId>
<version>@@@SNAPSHOT@@@</version>
</dependency>
When running the Rewrite Maven Plugin, everything works well, because 1.0.0
is in Maven Central, and @@@SNAPSHOT@@@
is in my local repo. The rewriting succeeds. However, when running the same recipe in a test environment using JUnit, resolution of the SNAPSHOT fails, inserting the following into the rewritten POM:
<!--~~(c:d:@@@SNAPSHOT@@@ failed. Unable to download POM. Tried repositories: https://repo.maven.apache.org/maven2: HTTP 404)~~>-->
<!--~~(c:d:@@@SNAPSHOT@@@ failed. Unable to download POM. Tried repositories: https://repo.maven.apache.org/maven2: Did not attempt to download because of a previous failure to retrieve from this repository.)~~>-->
If I had to guess, it is because in that environment, OpenRewrite does not look into the local repo. What can I do to make it find the SNAPSHOT?