dashorst opened a new issue, #1738:
URL: https://github.com/apache/wicket/issues/1738

   The OpenRewrite recipe `org.apache.wicket.MigrateToWicket10` in 
`wicket-migration` does not upgrade the `org.apache.wicket` dependencies of the 
project it migrates. They keep their Wicket 9 version, while the other steps of 
the recipe do run: the Jakarta and Java 17 changes, and adding `wicket-tester`. 
The result is a project with Wicket 9 core modules next to a Wicket 10 
`wicket-tester` and code written for Wicket 10.
   
   ## Reproduction
   
   Generate a quickstart from 
`org.apache.wicket:wicket-archetype-quickstart:9.25.0` and run, against Maven 
Central only:
   
   ```
   mvn -U org.openrewrite.maven:rewrite-maven-plugin:run \
     
-Drewrite.recipeArtifactCoordinates=org.apache.wicket:wicket-migration:10.12.0 \
     -Drewrite.activeRecipes=org.apache.wicket.MigrateToWicket10
   ```
   
   `wicket.version` stays at `9.25.0`, while the added `wicket-tester` gets 
`10.12.0`. Tested with rewrite-maven-plugin 6.46.1 on JDK 21.
   
   ## Cause
   
   The step that should raise the version, in 
`wicket-migration/src/main/resources/META-INF/rewrite/wicket.yml`:
   
   ```yaml
     - org.openrewrite.maven.UpgradeDependencyVersion:
         groupId: org.apache.wicket
         artifactId: "*"
         newVersion: 10.x
         versionPattern: -SNAPSHOT
   ```
   
   `versionPattern` restricts the candidate versions to those ending in 
`-SNAPSHOT`. Release repositories don't have any, so the step finds no 
candidate and silently does nothing. With that line removed, the same run moves 
`wicket.version` from 9.25.0 to 10.12.0.
   
   The line probably dates from before 10.0.0, when only snapshots existed. 
`MigrateToWicket10Test#migrateDependencies`, which covers this step, is 
`@Disabled("Requires first release of 10.x before we can update the version")` 
and was never enabled again, so the build never noticed.
   
   ## Fix
   
   On `wicket-10.x`: remove the `versionPattern: -SNAPSHOT` line and enable 
`MigrateToWicket10Test#migrateDependencies`. The same defect is being fixed on 
`master`, which also carries `MigrateToWicket11`, in a separate issue and pull 
request.
   
   10.12.0 is released, so its `wicket-migration` jar keeps the defect. This 
doesn't warrant a release of its own: target 10.13.0, or 10.12.1 if one is 
needed for another reason.
   
   ## Workaround
   
   Run the recipe while the project is still on Wicket 9, then set the Wicket 
version to 10.12.0 yourself, for example with `mvn versions:set-property 
-Dproperty=wicket.version -DnewVersion=10.12.0` when the version is in a 
property, as in the quickstart. Run the recipe first: `rewrite:run` compiles 
the project, and once the version is raised the code that still uses the 
`javax` namespace and the moved Wicket classes no longer compiles.
   
   Affects `wicket-migration` on `wicket-10.x`, 10.0.0 up to and including 
10.12.0.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to