openrewrite / rewrite-maven-plugin

OpenRewrite's Maven plugin.
https://openrewrite.github.io/rewrite-maven-plugin/plugin-info.html
Apache License 2.0
140 stars 73 forks source link

Add support for artifact recipes as file #800

Closed jonesbusy closed 3 months ago

jonesbusy commented 3 months ago

Hi,

The plugin already support recipeArtifactCoordinates that will resolve artifact from a remote repository and it's transitive dependency. I would like to support loading recipes directly from the file system without having the artifact published to a remote repository.

My use case imply that I don't want to add necessary maven repositories (via pom or settings) So I must resolve recipes locally.

I've just verified that tests are passing, but I didn't add any.

I've tested on a sample project

Right now recipeArtifactCoordinatestakes precedence on recipeArtifactFileswhen we can imagine support both by adding more classloader to the environment

mvn -Drewrite.activeRecipes=my.test.receipe.TestRecipe -Drewrite.recipeArtifactFiles=myjar.jar org.openrewrite.maven:rewrite-maven-plugin:5.34.0-SNAPSHOT:run

What's changed?

See before

What's your motivation?

See before

Anyone you would like to review specifically?

@timtebeek

Have you considered any alternatives or workarounds?

Yes by publishing to a remote temporary repository and updating maven repository. But is not convenient on my use case that I don't want to use any custom settings or update poms.

Any additional context

The GSoC 2024 https://summerofcode.withgoogle.com/programs/2024/projects/anaMmWRR

Checklist

jonesbusy commented 3 months ago

Closing the PR, at the end I can use the recipeArtifactCoordinates and get artifact from the local repository