This is an automated email from the ASF dual-hosted git repository.

dashorst pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git


The following commit(s) were added to refs/heads/master by this push:
     new 1067fdb588 Let the Wicket migration recipes upgrade the 
org.apache.wicket dependencies
1067fdb588 is described below

commit 1067fdb5887c7068b9a4e56c1eea8d6f8b2054e6
Author: Martijn Dashorst <[email protected]>
AuthorDate: Sat Oct 31 23:36:49 2026 +0100

    Let the Wicket migration recipes upgrade the org.apache.wicket dependencies
    
    MigrateToWicket10 and MigrateToWicket11 end with an
    UpgradeDependencyVersion step for org.apache.wicket:* that carries
    versionPattern: -SNAPSHOT. OpenRewrite discards snapshot, milestone and
    release candidate versions before it applies a versionPattern, so a
    release range combined with -SNAPSHOT matches no version at all, whether
    the project resolves from a release or a snapshot repository. The step
    never changed anything. 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 #1739
    See also GitHub issue #1738 for wicket-10.x
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 .../src/main/resources/META-INF/rewrite/wicket.yml |   2 -
 .../wicket/migration/MigrateToWicket10Test.java    |   9 +-
 .../wicket/migration/MigrateToWicket11Test.java    | 126 +++++++++++++++++++++
 .../10.12.0/wicket-metrics-10.12.0.pom             |  24 ++++
 .../wicket-metrics/maven-metadata-local.xml        |  28 +++++
 .../11.0.0/wicket-metrics-11.0.0.pom               |  24 ++++
 .../wicket-metrics/maven-metadata-local.xml        |  28 +++++
 .../wicket-core/10.12.0/wicket-core-10.12.0.pom    |  24 ++++
 .../wicket-core/11.0.0/wicket-core-11.0.0.pom      |  24 ++++
 .../wicket/wicket-core/maven-metadata-local.xml    |  29 +++++
 10 files changed, 312 insertions(+), 6 deletions(-)

diff --git a/wicket-migration/src/main/resources/META-INF/rewrite/wicket.yml 
b/wicket-migration/src/main/resources/META-INF/rewrite/wicket.yml
index 73aea2ac7e..1571984622 100644
--- a/wicket-migration/src/main/resources/META-INF/rewrite/wicket.yml
+++ b/wicket-migration/src/main/resources/META-INF/rewrite/wicket.yml
@@ -35,7 +35,6 @@ recipeList:
       groupId: org.apache.wicket
       artifactId: "*"
       newVersion: 10.x
-      versionPattern: -SNAPSHOT
   - org.openrewrite.maven.UpgradeDependencyVersion:
       groupId: org.apache.wicket.experimental.wicket9
       artifactId: "*"
@@ -139,5 +138,4 @@ recipeList:
       groupId: org.apache.wicket
       artifactId: "*"
       newVersion: 11.x
-      versionPattern: -SNAPSHOT
 ---
diff --git 
a/wicket-migration/src/test/java/org/apache/wicket/migration/MigrateToWicket10Test.java
 
b/wicket-migration/src/test/java/org/apache/wicket/migration/MigrateToWicket10Test.java
index 6bce2f1c57..91fb6007a3 100644
--- 
a/wicket-migration/src/test/java/org/apache/wicket/migration/MigrateToWicket10Test.java
+++ 
b/wicket-migration/src/test/java/org/apache/wicket/migration/MigrateToWicket10Test.java
@@ -16,7 +16,6 @@
 
 package org.apache.wicket.migration;
 
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.openrewrite.config.Environment;
 import org.openrewrite.java.JavaParser;
@@ -78,7 +77,6 @@ class MigrateToWicket10Test implements RewriteTest {
     }
 
     @Test
-    @Disabled("Requires first release of 10.x before we can update the 
version")
     void migrateDependencies() {
         //language=xml
         rewriteRun(
@@ -104,7 +102,7 @@ class MigrateToWicket10Test implements RewriteTest {
                                         </project>
                                         """,
                                 spec -> spec.after(pom -> {
-                                    Matcher version = 
Pattern.compile("10\\..+").matcher(pom);
+                                    Matcher version = 
Pattern.compile("<version>(10\\.[^<]+)</version>").matcher(pom);
                                     
assertThat(version.find()).describedAs("Expected 10.x in %s", pom).isTrue();
                                     return String.format("""
                                             <project>
@@ -112,6 +110,9 @@ class MigrateToWicket10Test implements RewriteTest {
                                                 <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>
@@ -120,7 +121,7 @@ class MigrateToWicket10Test implements RewriteTest {
                                                     </dependency>
                                                 </dependencies>
                                             </project>
-                                            """, version.group(0));
+                                            """, version.group(1));
                                 })
                         )
                 )
diff --git 
a/wicket-migration/src/test/java/org/apache/wicket/migration/MigrateToWicket11Test.java
 
b/wicket-migration/src/test/java/org/apache/wicket/migration/MigrateToWicket11Test.java
new file mode 100644
index 0000000000..d4f446f63c
--- /dev/null
+++ 
b/wicket-migration/src/test/java/org/apache/wicket/migration/MigrateToWicket11Test.java
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.wicket.migration;
+
+import org.junit.jupiter.api.Test;
+import org.openrewrite.ExecutionContext;
+import org.openrewrite.InMemoryExecutionContext;
+import org.openrewrite.config.Environment;
+import org.openrewrite.maven.MavenExecutionContextView;
+import org.openrewrite.maven.tree.MavenRepository;
+import org.openrewrite.test.RecipeSpec;
+import org.openrewrite.test.RewriteTest;
+
+import java.net.URISyntaxException;
+import java.util.List;
+
+import static org.openrewrite.java.Assertions.mavenProject;
+import static org.openrewrite.maven.Assertions.pomXml;
+
+/**
+ * Resolves the Wicket artifacts from the {@code maven-repository} fixture 
next to this class
+ * only, so the outcome does not depend on what Maven Central or the local 
repository contain.
+ */
+class MigrateToWicket11Test implements RewriteTest {
+
+    @Override
+    public void defaults(RecipeSpec spec) {
+        spec
+                .executionContext(fixtureRepositoryOnly())
+                .recipe(Environment.builder()
+                        .scanRuntimeClasspath()
+                        .build()
+                        
.activateRecipes("org.apache.wicket.MigrateToWicket11"));
+    }
+
+    private static ExecutionContext fixtureRepositoryOnly() {
+        String uri;
+        try {
+            uri = 
MigrateToWicket11Test.class.getResource("maven-repository").toURI().toString();
+        } catch (URISyntaxException e) {
+            throw new IllegalStateException(e);
+        }
+
+        ExecutionContext ctx = new InMemoryExecutionContext(t -> {
+            throw new AssertionError(t);
+        });
+        MavenExecutionContextView.view(ctx)
+                .setAddCentralRepository(false)
+                .setAddLocalRepository(false)
+                .setRepositories(List.of(MavenRepository.builder()
+                        .id("fixture")
+                        .uri(uri)
+                        .knownToExist(true)
+                        .build()));
+        return ctx;
+    }
+
+    @Test
+    void migrateDependencies() {
+        //language=xml
+        rewriteRun(
+                mavenProject("any-project",
+                        pomXml("""
+                                        <project>
+                                            <modelVersion>4.0.0</modelVersion>
+                                            <groupId>com.example</groupId>
+                                            <artifactId>wicket</artifactId>
+                                            <version>1.0.0</version>
+                                            <dependencies>
+                                                <dependency>
+                                                    
<groupId>org.apache.wicket</groupId>
+                                                    
<artifactId>wicket-core</artifactId>
+                                                    <version>10.12.0</version>
+                                                </dependency>
+                                                <dependency>
+                                                    
<groupId>org.apache.wicket.experimental.wicket10</groupId>
+                                                    
<artifactId>wicket-metrics</artifactId>
+                                                    <version>10.12.0</version>
+                                                </dependency>
+                                            </dependencies>
+                                        </project>
+                                        """,
+                                """
+                                        <project>
+                                            <modelVersion>4.0.0</modelVersion>
+                                            <groupId>com.example</groupId>
+                                            <artifactId>wicket</artifactId>
+                                            <version>1.0.0</version>
+                                            <properties>
+                                                
<maven.compiler.release>21</maven.compiler.release>
+                                            </properties>
+                                            <dependencies>
+                                                <dependency>
+                                                    
<groupId>org.apache.wicket</groupId>
+                                                    
<artifactId>wicket-core</artifactId>
+                                                    <version>11.0.0</version>
+                                                </dependency>
+                                                <dependency>
+                                                    
<groupId>org.apache.wicket.experimental.wicket11</groupId>
+                                                    
<artifactId>wicket-metrics</artifactId>
+                                                    <version>11.0.0</version>
+                                                </dependency>
+                                            </dependencies>
+                                        </project>
+                                        """
+                        )
+                )
+        );
+    }
+
+}
diff --git 
a/wicket-migration/src/test/java/org/apache/wicket/migration/maven-repository/org/apache/wicket/experimental/wicket10/wicket-metrics/10.12.0/wicket-metrics-10.12.0.pom
 
b/wicket-migration/src/test/java/org/apache/wicket/migration/maven-repository/org/apache/wicket/experimental/wicket10/wicket-metrics/10.12.0/wicket-metrics-10.12.0.pom
new file mode 100644
index 0000000000..7c70cc1177
--- /dev/null
+++ 
b/wicket-migration/src/test/java/org/apache/wicket/migration/maven-repository/org/apache/wicket/experimental/wicket10/wicket-metrics/10.12.0/wicket-metrics-10.12.0.pom
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0";>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.wicket.experimental.wicket10</groupId>
+  <artifactId>wicket-metrics</artifactId>
+  <version>10.12.0</version>
+  <packaging>pom</packaging>
+</project>
diff --git 
a/wicket-migration/src/test/java/org/apache/wicket/migration/maven-repository/org/apache/wicket/experimental/wicket10/wicket-metrics/maven-metadata-local.xml
 
b/wicket-migration/src/test/java/org/apache/wicket/migration/maven-repository/org/apache/wicket/experimental/wicket10/wicket-metrics/maven-metadata-local.xml
new file mode 100644
index 0000000000..55a899cb7a
--- /dev/null
+++ 
b/wicket-migration/src/test/java/org/apache/wicket/migration/maven-repository/org/apache/wicket/experimental/wicket10/wicket-metrics/maven-metadata-local.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<metadata>
+  <groupId>org.apache.wicket.experimental.wicket10</groupId>
+  <artifactId>wicket-metrics</artifactId>
+  <versioning>
+    <latest>10.12.0</latest>
+    <release>10.12.0</release>
+    <versions>
+      <version>10.12.0</version>
+    </versions>
+  </versioning>
+</metadata>
diff --git 
a/wicket-migration/src/test/java/org/apache/wicket/migration/maven-repository/org/apache/wicket/experimental/wicket11/wicket-metrics/11.0.0/wicket-metrics-11.0.0.pom
 
b/wicket-migration/src/test/java/org/apache/wicket/migration/maven-repository/org/apache/wicket/experimental/wicket11/wicket-metrics/11.0.0/wicket-metrics-11.0.0.pom
new file mode 100644
index 0000000000..ee7b0d77ec
--- /dev/null
+++ 
b/wicket-migration/src/test/java/org/apache/wicket/migration/maven-repository/org/apache/wicket/experimental/wicket11/wicket-metrics/11.0.0/wicket-metrics-11.0.0.pom
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0";>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.wicket.experimental.wicket11</groupId>
+  <artifactId>wicket-metrics</artifactId>
+  <version>11.0.0</version>
+  <packaging>pom</packaging>
+</project>
diff --git 
a/wicket-migration/src/test/java/org/apache/wicket/migration/maven-repository/org/apache/wicket/experimental/wicket11/wicket-metrics/maven-metadata-local.xml
 
b/wicket-migration/src/test/java/org/apache/wicket/migration/maven-repository/org/apache/wicket/experimental/wicket11/wicket-metrics/maven-metadata-local.xml
new file mode 100644
index 0000000000..1e91150a11
--- /dev/null
+++ 
b/wicket-migration/src/test/java/org/apache/wicket/migration/maven-repository/org/apache/wicket/experimental/wicket11/wicket-metrics/maven-metadata-local.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<metadata>
+  <groupId>org.apache.wicket.experimental.wicket11</groupId>
+  <artifactId>wicket-metrics</artifactId>
+  <versioning>
+    <latest>11.0.0</latest>
+    <release>11.0.0</release>
+    <versions>
+      <version>11.0.0</version>
+    </versions>
+  </versioning>
+</metadata>
diff --git 
a/wicket-migration/src/test/java/org/apache/wicket/migration/maven-repository/org/apache/wicket/wicket-core/10.12.0/wicket-core-10.12.0.pom
 
b/wicket-migration/src/test/java/org/apache/wicket/migration/maven-repository/org/apache/wicket/wicket-core/10.12.0/wicket-core-10.12.0.pom
new file mode 100644
index 0000000000..3fc2b9af40
--- /dev/null
+++ 
b/wicket-migration/src/test/java/org/apache/wicket/migration/maven-repository/org/apache/wicket/wicket-core/10.12.0/wicket-core-10.12.0.pom
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0";>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.wicket</groupId>
+  <artifactId>wicket-core</artifactId>
+  <version>10.12.0</version>
+  <packaging>pom</packaging>
+</project>
diff --git 
a/wicket-migration/src/test/java/org/apache/wicket/migration/maven-repository/org/apache/wicket/wicket-core/11.0.0/wicket-core-11.0.0.pom
 
b/wicket-migration/src/test/java/org/apache/wicket/migration/maven-repository/org/apache/wicket/wicket-core/11.0.0/wicket-core-11.0.0.pom
new file mode 100644
index 0000000000..fff5758cdc
--- /dev/null
+++ 
b/wicket-migration/src/test/java/org/apache/wicket/migration/maven-repository/org/apache/wicket/wicket-core/11.0.0/wicket-core-11.0.0.pom
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0";>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.wicket</groupId>
+  <artifactId>wicket-core</artifactId>
+  <version>11.0.0</version>
+  <packaging>pom</packaging>
+</project>
diff --git 
a/wicket-migration/src/test/java/org/apache/wicket/migration/maven-repository/org/apache/wicket/wicket-core/maven-metadata-local.xml
 
b/wicket-migration/src/test/java/org/apache/wicket/migration/maven-repository/org/apache/wicket/wicket-core/maven-metadata-local.xml
new file mode 100644
index 0000000000..4767e9af19
--- /dev/null
+++ 
b/wicket-migration/src/test/java/org/apache/wicket/migration/maven-repository/org/apache/wicket/wicket-core/maven-metadata-local.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<metadata>
+  <groupId>org.apache.wicket</groupId>
+  <artifactId>wicket-core</artifactId>
+  <versioning>
+    <latest>11.0.0</latest>
+    <release>11.0.0</release>
+    <versions>
+      <version>10.12.0</version>
+      <version>11.0.0</version>
+    </versions>
+  </versioning>
+</metadata>

Reply via email to