jakarta-migrationopenrewrite

How to use openrewrite to do javax to jakarta package conversion in spring roo generated aspectj(aj) file


We have a legacy project which has spring roo generated aspectj (aj) for the domain objects. These files contains javax import statements. I am using openrewrite to migrate to jakarta ee 10. However only the java files are being converted.

  1. Is there any provision to say consider *.aj file as well as part the jakarta ee 10 migration openrewrite recipe?
  2. Do I need to write a custom recipe to accomplish the same?

Solution

  • We don't currently have a dedicated parser for .aj files, which would be necessary to make reliable type-based code changes.

    If you're ok with doing text-based replacements, you could look at passing in rewrite.plainTextMasks to include **/*.aj as files parsed as text, and then use our Find and Replace recipe to update your AspectJ imports.

    The next release of the plugins will contain a change to parse .aj files as plain text by default:

    I hope that helps!