Skip to content

Let MigrateToWicket10 upgrade the org.apache.wicket dependencies - #1741

Open
dashorst wants to merge 1 commit into
apache:wicket-10.xfrom
dashorst:fix-migration-recipe-wicket-version-10.x
Open

dashorst wants to merge 1 commit into
apache:wicket-10.xfrom
dashorst:fix-migration-recipe-wicket-version-10.x

Conversation

@dashorst

Copy link
Copy Markdown
Contributor

Fixes #1738.

MigrateToWicket10 upgraded everything except the Wicket version. Its UpgradeDependencyVersion step for org.apache.wicket:* carried versionPattern: -SNAPSHOT, which limits the candidates to snapshots; release repositories have none, so the step did nothing. A Wicket 9 project came out with Java 17, Jakarta, the PushHeaderItem change and the http2 dependencies removed, but with its Wicket 9 core artifacts, while the wicket-tester dependency the recipe adds came in at the latest 10.x.

This PR removes the versionPattern, re-enables MigrateToWicket10Test#migrateDependencies (disabled since before the first 10.x release) and corrects its expectation: the version regex captured the closing tag, and the expected pom lacked the maven.compiler.release property that UpgradeToJava17 adds.

One change is specific to 10.x: the root pom manages com.fasterxml.jackson.core:jackson-databind at 2.14.3, which also reached wicket-migration, while rewrite-maven brings jackson-dataformat-xml 2.17.2. With the test enabled, reading the Maven settings failed with NoSuchMethodError: PropertyName.merge(...) before the recipe ran. wicket-migration now manages jackson-databind at 2.17.2, matching OpenRewrite's other Jackson artifacts. Master manages Jackson 3 (tools.jackson) in the root pom and does not have this problem.

The master fix is #1740 (issue #1739).

Test before the recipe fix

mvn -B verify -pl wicket-migration -Dtest=MigrateToWicket10Test, with the test enabled, the expectation corrected and the Jackson pin applied, but versionPattern still in place:

[ERROR] Failures: 
[ERROR]   MigrateToWicket10Test.migrateDependencies:83->lambda$migrateDependencies$0:107 [Expected 10.x in <project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example</groupId>
    <artifactId>wicket</artifactId>
    <version>1.0.0</version>
    <properties>
        <maven.compiler.release>17</maven.compiler.release>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.apache.wicket</groupId>
            <artifactId>wicket-core</artifactId>
            <version>9.12.0</version>
        </dependency>
    </dependencies>
</project>] 
Expecting value to be true but was false
[ERROR] Tests run: 2, Failures: 1, Errors: 0, Skipped: 0

Without the Jackson pin the test errors instead:

[ERROR]   MigrateToWicket10Test.migrateDependencies:83 » NoSuchMethod 'com.fasterxml.jackson.databind.PropertyName com.fasterxml.jackson.databind.PropertyName.merge(com.fasterxml.jackson.databind.PropertyName, com.fasterxml.jackson.databind.PropertyName)'

Test after the fix

[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.751 s -- in org.apache.wicket.migration.MigrateToWicket10Test
[INFO] BUILD SUCCESS

A full mvn clean verify -Pjs-test is green locally; japicmp reports nothing.

Quickstart

MigrateToWicket10 from the released wicket-migration:10.12.0, run through rewrite-maven-plugin 6.46.1 on a 9.25.0 quickstart, leaves wicket.version at 9.25.0 while the added wicket-tester gets 10.12.0. A local copy of the recipe without versionPattern sets wicket.version to 10.12.0. The released recipe ran fine through the plugin despite the 2.14.3 management, so the Jackson pin concerns this module's test classpath.

🤖 Generated with Claude Code

MigrateToWicket10 ends 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 Wicket
9 project migrated with the recipe kept its Wicket 9 wicket-core and the
other org.apache.wicket artifacts, while the remaining steps did run: the
move to Java 17, the javax to jakarta migration, the PushHeaderItem type
change and the removal of the experimental http2 dependencies. Where the
project used WicketTester, the wicket-tester dependency the recipe adds
came in at the latest 10.x release. The result was a project mixing
Wicket 9 core artifacts with Wicket 10, Java 17 and Jakarta changes, and
the recipe gave no sign of it.

The versionPattern is removed, so the step selects the latest 10.x
release. Running the 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.

Enabled, the test could not run on this branch: the root pom manages
com.fasterxml.jackson.core:jackson-databind at 2.14.3, which also applied
to wicket-migration, while rewrite-maven brings jackson-dataformat-xml
2.17.2. Reading the Maven settings then failed with a NoSuchMethodError
on PropertyName.merge. wicket-migration now manages jackson-databind at
2.17.2, the version the rest of OpenRewrite's Jackson dependencies use.

This is the wicket-10.x counterpart of commit cd372c3 on master.

GitHub issue apache#1738
See also GitHub issue apache#1739 and pull request apache#1740 for master

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant