Rewrite third party project using rewrite-maven-plugin

133 Views Asked by At

I have a Maven Multimodule project and one method in the code of a third-party library I need to rewrite. What I do is unpack the sources.jar of that project to target/generated-sources/3rdparty/ followed by the build-helper-plugin to add this folder as source directory.

So far so good.Next step is to write a recipe.

There are a couple of things I noticed: there doesn't seem to be a goal I can call just scoped to this module. If I bind runNoFork to the generate-sources phase, it is scanning all modules. Also, it seems that this plugin doesn't use the sourcedirectories from a Maven project, hance these files are not detected. Is this a bug or is there something I can configure to scan this directory?

1

There are 1 best solutions below

4
Tim On

Good seeing you here! We unfortunately don't yet support build-helper-plugin. It's come up a couple months ago, but I hadn't had time to look into it so far. It sounds like we should indeed adopt the source directories you mention and work that into openrewrite/rewrite-maven-plugin. Welcome to open an issue and we'll see what we can do.

Do I understand your use case correctly in that you want to take the source jar of an existing 3rdparty library, modify that with a recipe, and use the modified sources in your own project? Just so I have the use case straight and can think through any alternative solutions.

Also: know that you're always welcome to reach out if there's any way in which I can help. We have a public Slack, issues, and predictable first name email addresses at moderne.io.

Related Questions in REWRITE-MAVEN-PLUGIN