openrewrite / rewrite-docs

Stores the markdown documents used to generate docs.openrewrite.org
https://docs.openrewrite.org
Apache License 2.0
39 stars 42 forks source link

How to run OpenRewrite against Ant projects? #247

Open paulbarr opened 7 months ago

paulbarr commented 7 months ago

I have a build that uses ant I want to run some OpenRewrite receipes against it

Previously there was this page that described how I could do that (it was there a week ago): https://docs.openrewrite.org/running-recipes/running-rewrite-without-build-tool-plugins

That page is gone now. Can I run OpenRewrite recipes against an ant build?

timtebeek commented 7 months ago

Hi @paulbarr ; I see you also asked this on StackOverflow; let me copy the answer I gave there here as well.

We've recently removed that page as it had not been updated since the moved to Rewrite 8. We now recommend folks to use the Moderne CLI when using neither Maven nor Gradle.

Ant is not supported officially, but I know of at least two community members who got recipe runs to work for Ant. Feel free to join our Slack and I'll try to put you in touch there. I don't know how far they got in terms of resolving dependencies, as I didn't yet see any outcome shared there.

Also, just this past week, we had a community member wire up projects built with headless Eclipse; he might also have some insights to share with you regarding how to get things running on Rewrite 8.

Hope that helps!

timtebeek commented 7 months ago

If you get this working for Ant, might I ask that you share your learnings (or even code) here? This request comes up from time to time, and would be really good to have a place to reference, even if we don't yet officially support Ant for now.

paulbarr commented 7 months ago

Hey,

Thanks for coming back to me. Any chance you could send me the content of the old page? I want to try a few different things to see if I can get it working

Cheers, PB


Paul Barry, Architect, IBM Transformation Advisor Slack: @paulbarr Email: @.*** To get the full value of joy you must have someone to divide it with


From: Tim te Beek @.> Sent: Friday, November 17, 2023 1:21 PM To: openrewrite/rewrite-docs @.> Cc: PAUL BARRY @.>; Mention @.> Subject: [EXTERNAL] Re: [openrewrite/rewrite-docs] Page describing how to run OpenRewrite reciepes against non gradle/maven build is gone (Issue #247)

Hi @paulbarr ; I see you also asked this on StackOverflow; let me copy the answer I gave there here as well. We've recently removed that page as it had not been updated since the moved to Rewrite 8. We now recommend folks to use the Moderne ZjQcmQRYFpfptBannerStart This Message Is From an External Sender This message came from outside your organization. https://us-phishalarm-ewt.proofpoint.com/EWT/v1/PjiDSg!2I-qKrTUgvMyUm6TUiKtxAfkm1qeyNIldr1ljbqapVVgtE_0IyUUTuighf_cRalrUvNV-3ZS1iLgdSvsz7Rtx9-FtS0nwMaUBT3klvjy4RPXx9U$ Report Suspicious

ZjQcmQRYFpfptBannerEnd

Hi @paulbarrhttps://github.com/paulbarr ; I see you also asked this on StackOverflowhttps://stackoverflow.com/questions/77501642/where-are-the-instructions-for-running-openrewrite-receipes-when-my-build-is-not; let me copy the answer I gave there here as well.

We've recently removed that page as it had not been updated since the moved to Rewrite 8. We now recommendhttps://github.com/openrewrite/rewrite-docs/issues/244#issuecomment-1806799876 folks to use the Moderne CLIhttps://docs.moderne.io/user-documentation/getting-started/cli-intro when using neither Maven nor Gradle.

Ant is not supported officially, but I know of at least two community members who got recipe runs to work for Ant. Feel free to join our Slackhttps://join.slack.com/t/rewriteoss/shared_invite/zt-nj42n3ea-b%7E62rIHzb3Vo0E1APKCXEA and I'll try to put you in touch there. I don't know how far they got in terms of resolving dependencies, as I didn't yet see any outcome shared there.

Also, just this past week, we had a community member wire up projects built with headless Eclipse; he might also have some insights to share with you regarding how to get things running on Rewrite 8.

Hope that helps!

— Reply to this email directly, view it on GitHubhttps://github.com/openrewrite/rewrite-docs/issues/247#issuecomment-1816418287, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AD677TUZYZHJ3WW4VSCUYKDYE5QEHAVCNFSM6AAAAAA7PZCHGGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJWGQYTQMRYG4. You are receiving this because you were mentioned.Message ID: @.***>

timtebeek commented 7 months ago

Sure; it was removed in this PR, so you can see the latest version up there still.

Here's a deep link to our Slack for that Eclipse project implementation. Some notes copied from there:

perhaps it helps to see how we create the LargeSourceSet in the Maven plugin we had quite some changes going from Rewrite 7 to Rewrite 8; the LargeSourceSet changes are part of that we haven't documented the internal changes that were required at the time, but perhaps it helps to see what we changed in the Maven plugin back then you can see that for instance here you can run a recipe to get a list of results

List<SourceFile> poms = mp.parse(Collections.singleton(project.getFile().toPath()), baseDir, ctx).collect(Collectors.toList());
List<Result> results = recipe.run(new InMemoryLargeSourceSet(poms), ctx).getChangeset().getAllResults();