Skip to content

Let the Wicket migration recipes upgrade the org.apache.wicket dependencies - #1740

Open
dashorst wants to merge 1 commit into
apache:masterfrom
dashorst:fix-migration-recipe-wicket-version
Open

dashorst wants to merge 1 commit into
apache:masterfrom
dashorst:fix-migration-recipe-wicket-version

Conversation

@dashorst

Copy link
Copy Markdown
Contributor

Fixes #1739.

The MigrateToWicket10 and MigrateToWicket11 recipes in wicket-migration end with an UpgradeDependencyVersion step for org.apache.wicket:* that carries versionPattern: -SNAPSHOT. That pattern only accepts snapshot versions, which release repositories don't have, so the step silently did nothing. A migrated project kept its old wicket-core, while the other steps (Java baseline, type changes, the wicket-metrics groupId move) did run. This PR removes the two versionPattern lines.

The tests:

  • MigrateToWicket10Test#migrateDependencies is re-enabled. It had been @Disabled until the first 10.x release and was never turned back on, which is how the defect went unnoticed. Its expectation is also corrected: the version regex captured the closing </version> tag, and the expected pom lacked the maven.compiler.release property that UpgradeToJava17 adds. It resolves 10.x from Maven Central, as before.
  • MigrateToWicket11Test is new. 11.0.0 is not on Central yet, so the test resolves wicket-core and wicket-metrics from a small file-based Maven repository fixture next to the test (maven-repository/, pom-packaged poms plus maven-metadata-local.xml). Central and ~/.m2 are switched off for that execution context, so the result does not depend on what has been released or installed locally.

Before and after

Both tests against the unfixed recipe (mvn verify -pl wicket-migration -Dtest='MigrateToWicket1*Test'):

[ERROR]   MigrateToWicket10Test.migrateDependencies:82->lambda$migrateDependencies$0:106 [Expected 10.x in <project>
    ...
        <dependency>
            <groupId>org.apache.wicket</groupId>
            <artifactId>wicket-core</artifactId>
            <version>9.12.0</version>
        </dependency>
    ...
[ERROR]   MigrateToWicket11Test.migrateDependencies:76 [Unexpected result in "any-project/pom.xml":
@@ -10,7 +10,7 @@
         <dependency>
             <groupId>org.apache.wicket</groupId>
             <artifactId>wicket-core</artifactId>
-            <version>11.0.0</version>
+            <version>10.12.0</version>
         </dependency>
         <dependency>
             <groupId>org.apache.wicket.experimental.wicket11</groupId>
[ERROR] Tests run: 3, Failures: 2, Errors: 0, Skipped: 0

The 11 failure shows the mixed result: wicket-metrics has moved to experimental.wicket11 11.0.0, wicket-core is still 10.12.0.

With the fix:

[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0 -- in org.apache.wicket.migration.MigrateToWicket10Test
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 -- in org.apache.wicket.migration.MigrateToWicket11Test

mvn clean verify -Pjs-test is green.

Quickstart runs with rewrite-maven-plugin 6.46.1:

Recipe Start Released recipe Recipe without versionPattern
MigrateToWicket11 (wicket-migration 11.0.0 RC) 10.12.0 quickstart wicket.version stays 10.12.0; metrics groupId, ICrypt and Java 21 steps applied wicket.version 11.0.0; migrated quickstart passes mvn verify
MigrateToWicket10 (wicket-migration 10.12.0) 9.25.0 quickstart wicket.version stays 9.25.0, while the added wicket-tester gets 10.12.0 wicket.version 10.12.0

Scope

Master only for now. The 10.x and 11.0 release lines are left out on purpose: the wicket-10.x fix is tracked in #1738 and is not part of this PR, and nothing here goes into the 11.0.0 release.

🤖 Generated with Claude Code

…encies

MigrateToWicket10 and MigrateToWicket11 end with an
UpgradeDependencyVersion step for org.apache.wicket:* that carries
versionPattern: -SNAPSHOT. That pattern restricts the candidate versions
to snapshots, and release repositories have none, so the step found
nothing and left the version alone. A project migrated with either
recipe kept its old wicket-core and the other org.apache.wicket
artifacts, while the remaining steps did run: the Java baseline, the
type changes and, for MigrateToWicket11, the move of wicket-metrics to
the experimental.wicket11 groupId at 11.x. The result was a project
mixing old core artifacts with new code changes, and the recipe gave no
sign of it.

The versionPattern is removed from both steps, so they select the latest
release of the target line. Running either recipe now also upgrades the
org.apache.wicket dependencies, or the property that holds their version.

MigrateToWicket10Test#migrateDependencies had been disabled until the
first 10.x release and never re-enabled, which is how this went
unnoticed. It is enabled again, with its expectation corrected: the
version regex captured the closing tag, and the expected pom lacked the
maven.compiler.release property that UpgradeToJava17 adds.
MigrateToWicket11Test is new and resolves wicket-core and wicket-metrics
from a small file-based repository next to the test, with Maven Central
and the local repository switched off, so it does not depend on what has
been released.

GitHub issue apache#1739
See also GitHub issue apache#1738 for wicket-10.x

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.17%. Comparing base (75ba768) to head (cd372c3).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1740      +/-   ##
============================================
- Coverage     63.17%   63.17%   -0.01%     
- Complexity    11558    11559       +1     
============================================
  Files          1253     1253              
  Lines         48635    48635              
  Branches       6844     6844              
============================================
- Hits          30725    30724       -1     
- Misses        15192    15193       +1     
  Partials       2718     2718              
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MigrateToWicket11 leaves the org.apache.wicket dependencies at their Wicket 10 version

2 participants