I have been following the instructions Refactoring with declarative YAML recipes. In my case project "A" is a multi-module maven build. I added a module "functional" that has an Example.yml under src/main/resources/META-INF/rewrite. I see Example.yml in the jar file.
My project "B" is a normal maven build (not multi module). It has the rewrite plugin in the pom and with an active recipe which is defined in "A"s Example.yml.
When I run it get the error:
at org.openrewrite.config.Environment.activateRecipes (Environment.java:123)
at org.openrewrite.maven.AbstractRewriteMojo.listResults (AbstractRewriteMojo.java:240)
at org.openrewrite.maven.AbstractRewriteRunMojo.execute (AbstractRewriteRunMojo.java:54)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
When I run: rewrite:discover it does not list my recipe.
In a multiple module maven build where should the yml be located? Any suggestions for debugging this? If I run rewrite:discover
Here is the rewrite plugin I am using in project B
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<version>4.44.0</version>
<configuration>
<activeRecipes>
<recipe>xxxxx.functional.Example</recipe>
</activeRecipes>
</configuration>
</plugin>
As pointed out by Tim it looks like the problem is that your plugin configuration doesn't declare a dependency on the functional
artifact containing your recipes. Your plugin should look something like this:
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<version>4.44.0</version>
<configuration>
<activeRecipes>
<recipe>xxxxx.functional.Example</recipe>
</activeRecipes>
</configuration>
<dependencies>
<dependency>
<groupId>com.yourorg.recipes</groupId>
<artifactId>functional</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>
</plugin>
Please refer to the documentation for more details.