Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WINDUP-3128: mta-cli script openrewrite #76

Merged
merged 8 commits into from
Nov 30, 2021

Conversation

m-brophy
Copy link
Contributor

@m-brophy m-brophy commented Nov 17, 2021

https://issues.redhat.com/browse/WINDUP-3128

this needs this rulesets PR to work: windup/windup-rulesets#570

an openrewrite migration can now be called from the mta-cli script using this format of command:

./mta-cli --openrewrite "-DactiveRecipes=org.jboss.windup.JavaxToJakarta" --input /home/mbrophy/Projects/spring-petclinic-migration --goal dryRun

Argument details:

--openrewrite this is a flag specifying to run an openrewrite migration rather than an MTA analysis. The two cannot be run together simultaneously, it must be one or the other.

"-DactiveRecipes=org.jboss.windup.JavaxToJakarta" This tells openrewrite which recipe to apply to the input project. JavaxtoJakarta is the default shipped recipe but a user can add their own to the shipped rewrite.yml and run that recipe instead if they so choose. The shipped rewrite.yml file is located in the rules/openrewrite/ folder in the unzipped MTA distribution.

--input this is the path to the source project which the openrewrite migration is to be performed upon.

--goal this is the openrewrite maven goal to run. This argument is optional, if not supplied the script will run the dryRungoal which reports on the changes and creates a patch file which can be applied later. To apply the recipe changes immediately without this stage, the run goal can be supplied as this argument instead.

@PhilipCattanach
Copy link
Contributor

PhilipCattanach commented Nov 24, 2021

@m-brophy My testing went very well I tested he recipes against the spring-petclinic-migration project and all of the import javax.*
packages were replaced, except 2.
The 2 were javax.cache.* packages. But I need to check whether there are jakarta equivalents for those.

/spring-petclinic-migration/src/main/java/org/springframework/samples/petclinic/system/CacheConfig.java:import javax.cache.configuration.Configuration;
/spring-petclinic-migration/src/main/java/org/springframework/samples/petclinic/system/CacheConfig.java:import javax.cache.configuration.MutableConfiguration;

@m-brophy
Copy link
Contributor Author

@PhilipCattanach Those packages were never officially accepted into java EE, they were part of JSR107
It's unclear to me what we should do about it in terms of migrating these packages.

see here

I suppose we could just leave them as they are, not being part of Java EE

Copy link
Member

@mrizzi mrizzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@m-brophy one initial "blocker" to be fixed.

Copy link
Member

@mrizzi mrizzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@m-brophy one initial "blocker" to be fixed.

src/main/assembly/assembly-offline.xml Show resolved Hide resolved
@PhilipCattanach
Copy link
Contributor

I have repeated my tests after rebuilding to include the latest commit and everything worked perfectly.

Copy link
Member

@mrizzi mrizzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on Fedora and MacOS and it worked fine 👍
Thanks a lot @m-brophy

m-brophy and others added 3 commits November 26, 2021 10:15
Copy link
Contributor

@PhilipCattanach PhilipCattanach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully tested on Windows 11 and RHEL CSB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants