Skip to content

Conversation

@m-brophy
Copy link
Contributor

@m-brophy m-brophy commented Nov 2, 2022

No description provided.

m-brophy and others added 3 commits January 13, 2023 11:40
…PRULE-909

# Conflicts:
#	rules/rules-reviewed/eap8/eap6/eap8.ejb.windup.xml
#	rules/rules-reviewed/eap8/eap6/tests/data/ejb/EJBContextMethodsTest.java
#	rules/rules-reviewed/eap8/eap6/tests/eap8.ejb.windup.test.xml
@PhilipCattanach
Copy link
Contributor

@m-brophy
Can I ask a question about the nature of the recipes.
They all appear to replace the old Group and Artifact with a new Group, Artifact and Version (but the version value looks like a placeholder). Then the dependency scope is updated. So I presume that 'placeholder' version is just getting stripped out. Is that just a quirk of home Openrewrite works, it is a 2 step process?

org.openrewrite.maven.ChangeDependencyGroupIdAndArtifactId:
oldGroupId: org.jboss.spec.javax.annotation
oldArtifactId: jboss-annotations-api_1.3_spec
newGroupId: jakarta.annotation
newArtifactId: jakarta.annotation-api
newVersion: 2.1.X
- org.openrewrite.maven.ChangeDependencyScope:
groupId: jakarta.annotation
artifactId: jakarta.annotation-api

@m-brophy
Copy link
Contributor Author

m-brophy commented May 5, 2023

Hi @PhilipCattanach -

The version value is an actual value - 2.1.X just means the latest minor version of the 2.1 version set, openrewrite works it out itself.

The ChangeDependencyScope call removes the scope from the dependency if you don't provide it with a scope parameter so that's what that is doing. The reason it's there is that to migrate an app you first run the existing JavaxToJakarta recipe so that the imports etc get updated correctly but that provides a new dependency to fit the altered code, jakarta.annotation-api in the example you give. When we then run this recipe it converts the jboss dependency to the same artifact. However if it's a starter-app the scope is provided. We make a call to remove duplicate dependencies like this at the end of the recipe, but this doesn't do anything if the scope is different on the two dependencies so we delete the scope after updating jboss javax dependencies before deleting duplicates.

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.

2 participants