From ff34dc089b690492a7178b9c1c576cb49f1f3bc0 Mon Sep 17 00:00:00 2001 From: Maxim Solodovnik Date: Tue, 13 Oct 2026 10:28:20 +0700 Subject: [PATCH 1/3] Fixes issue #1658: quickstart is tested during build --- archetypes/quickstart/pom.xml | 5 +++++ .../src/test/java/Start.java | 17 ++++++++------ .../sample-it-test/archetype.properties | 22 +++++++++++++++++++ .../projects/sample-it-test/goal.txt | 1 + 4 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 archetypes/quickstart/src/test/resources/projects/sample-it-test/archetype.properties create mode 100644 archetypes/quickstart/src/test/resources/projects/sample-it-test/goal.txt diff --git a/archetypes/quickstart/pom.xml b/archetypes/quickstart/pom.xml index 2de2937612a..d8b12aa478a 100644 --- a/archetypes/quickstart/pom.xml +++ b/archetypes/quickstart/pom.xml @@ -48,6 +48,11 @@ + + + ${project.basedir}/src/test/resources + + org.apache.maven.archetype diff --git a/archetypes/quickstart/src/main/resources/archetype-resources/src/test/java/Start.java b/archetypes/quickstart/src/main/resources/archetype-resources/src/test/java/Start.java index f40a28a3bc7..ed97885b009 100644 --- a/archetypes/quickstart/src/main/resources/archetype-resources/src/test/java/Start.java +++ b/archetypes/quickstart/src/main/resources/archetype-resources/src/test/java/Start.java @@ -17,6 +17,7 @@ package ${package}; import java.lang.management.ManagementFactory; +import java.time.Duration; import javax.management.MBeanServer; @@ -28,13 +29,14 @@ import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.SslConnectionFactory; -import org.eclipse.jetty.server.session.DefaultSessionCache; -import org.eclipse.jetty.server.session.FileSessionDataStore; -import org.eclipse.jetty.servlet.ServletContextHandler; +import org.eclipse.jetty.session.DefaultSessionCache; +import org.eclipse.jetty.session.FileSessionDataStore; import org.eclipse.jetty.util.resource.Resource; +import org.eclipse.jetty.util.resource.ResourceFactory; import org.eclipse.jetty.util.ssl.SslContextFactory; -import org.eclipse.jetty.webapp.WebAppContext; -import org.eclipse.jetty.websocket.jakarta.server.config.JakartaWebSocketServletContainerInitializer; +import org.eclipse.jetty.ee11.servlet.ServletContextHandler; +import org.eclipse.jetty.ee11.webapp.WebAppContext; +import org.eclipse.jetty.ee11.websocket.jakarta.server.config.JakartaWebSocketServletContainerInitializer; /** * Separate startup class for people that want to run the examples directly. Use parameter @@ -42,6 +44,7 @@ */ public class Start { + private static final int TIMEOUT = (int) Duration.ofHours(1).toMillis(); /** * Main function, starts the jetty server. * @@ -60,11 +63,11 @@ public static void main(String[] args) throws Exception ServerConnector http = new ServerConnector(server, new HttpConnectionFactory(http_config)); http.setPort(8080); - http.setIdleTimeout(1000 * 60 * 60); + http.setIdleTimeout(TIMEOUT); server.addConnector(http); - Resource keystore = Resource.newClassPathResource("/keystore"); + Resource keystore = ResourceFactory.root().newClassLoaderResource("/keystore"); if (keystore != null && keystore.exists()) { // if a keystore for a SSL certificate is available, start a SSL diff --git a/archetypes/quickstart/src/test/resources/projects/sample-it-test/archetype.properties b/archetypes/quickstart/src/test/resources/projects/sample-it-test/archetype.properties new file mode 100644 index 00000000000..f761540be4e --- /dev/null +++ b/archetypes/quickstart/src/test/resources/projects/sample-it-test/archetype.properties @@ -0,0 +1,22 @@ +################################################################################ +## +## 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. +## +################################################################################ +groupId=org.apache.wicket.example +artifactId=my-test-app +version=1.0.0-SNAPSHOT +package=org.apache.wicket.example diff --git a/archetypes/quickstart/src/test/resources/projects/sample-it-test/goal.txt b/archetypes/quickstart/src/test/resources/projects/sample-it-test/goal.txt new file mode 100644 index 00000000000..31ed2f87a27 --- /dev/null +++ b/archetypes/quickstart/src/test/resources/projects/sample-it-test/goal.txt @@ -0,0 +1 @@ +clean verify From 9a9f69f6e5cfb1e8f9e79014da4a96066eaba3b6 Mon Sep 17 00:00:00 2001 From: Martijn Dashorst Date: Tue, 13 Oct 2026 11:19:03 +0200 Subject: [PATCH 2/3] Build the quickstart integration test against the reactor's Wicket The archetype integration test ran clean verify on the generated project with whatever Wicket artifacts the local repository or the Apache snapshot repository held. CI runs verify without install, and the archetype module did not depend on the modules the generated project uses, so the reactor could even build it before them. A change to wicket-core or wicket-native-websocket-javax was tested against the previous nightly snapshot, and right after a version bump the generated project could not resolve Wicket at all until a snapshot of the new version was published. The archetype module now declares the generated project's Wicket modules as test dependencies, which orders it after them in the reactor, and maven-invoker-plugin:install copies them, their reactor dependencies and their parent poms into the local repository before the integration test runs. A plain mvn verify therefore writes these snapshots to the local repository, as mvn install would have. The installation and the integration test both follow -DskipTests, so a build that skips tests no longer generates and builds a project; -Darchetype.test.skip still skips the integration test alone. Start.java loses what was left over from Jetty 11: the unused session store imports, the commented-out session cache line and the obsolete JSR-356 instructions. The JSESSIONID hint uses the Jetty 12 session handler API, and the HTTP idle timeout is the literal it was before. GitHub issue #1658 Generated-by: Claude Code (Claude Opus 5.5) --- archetypes/quickstart/pom.xml | 36 +++++++++++++++++++ .../src/test/java/Start.java | 22 +++--------- pom.xml | 6 ++++ 3 files changed, 47 insertions(+), 17 deletions(-) diff --git a/archetypes/quickstart/pom.xml b/archetypes/quickstart/pom.xml index d8b12aa478a..552a19b4d3f 100644 --- a/archetypes/quickstart/pom.xml +++ b/archetypes/quickstart/pom.xml @@ -28,9 +28,31 @@ Wicket Quickstart Archetype + ${skipTests} + ${skipTests} true + false + + + + org.apache.wicket + wicket-core + test + + + org.apache.wicket + wicket-native-websocket-javax + test + + + org.apache.wicket + wicket-tester + test + + + @@ -80,6 +102,20 @@ org.apache.maven.plugins maven-archetype-plugin + + org.apache.maven.plugins + maven-invoker-plugin + + + + install + + + test + + + + org.apache.maven.plugins maven-resources-plugin diff --git a/archetypes/quickstart/src/main/resources/archetype-resources/src/test/java/Start.java b/archetypes/quickstart/src/main/resources/archetype-resources/src/test/java/Start.java index ed97885b009..22190208bed 100644 --- a/archetypes/quickstart/src/main/resources/archetype-resources/src/test/java/Start.java +++ b/archetypes/quickstart/src/main/resources/archetype-resources/src/test/java/Start.java @@ -17,11 +17,13 @@ package ${package}; import java.lang.management.ManagementFactory; -import java.time.Duration; import javax.management.MBeanServer; import org.apache.wicket.protocol.ws.javax.WicketServerEndpointConfig; +import org.eclipse.jetty.ee11.servlet.ServletContextHandler; +import org.eclipse.jetty.ee11.webapp.WebAppContext; +import org.eclipse.jetty.ee11.websocket.jakarta.server.config.JakartaWebSocketServletContainerInitializer; import org.eclipse.jetty.jmx.MBeanContainer; import org.eclipse.jetty.server.HttpConfiguration; import org.eclipse.jetty.server.HttpConnectionFactory; @@ -29,14 +31,9 @@ import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.SslConnectionFactory; -import org.eclipse.jetty.session.DefaultSessionCache; -import org.eclipse.jetty.session.FileSessionDataStore; import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.util.resource.ResourceFactory; import org.eclipse.jetty.util.ssl.SslContextFactory; -import org.eclipse.jetty.ee11.servlet.ServletContextHandler; -import org.eclipse.jetty.ee11.webapp.WebAppContext; -import org.eclipse.jetty.ee11.websocket.jakarta.server.config.JakartaWebSocketServletContainerInitializer; /** * Separate startup class for people that want to run the examples directly. Use parameter @@ -44,7 +41,6 @@ */ public class Start { - private static final int TIMEOUT = (int) Duration.ofHours(1).toMillis(); /** * Main function, starts the jetty server. * @@ -63,7 +59,7 @@ public static void main(String[] args) throws Exception ServerConnector http = new ServerConnector(server, new HttpConnectionFactory(http_config)); http.setPort(8080); - http.setIdleTimeout(TIMEOUT); + http.setIdleTimeout(1000 * 60 * 60); server.addConnector(http); @@ -104,19 +100,11 @@ public static void main(String[] args) throws Exception bb.setContextPath("/"); bb.setWar("src/main/webapp"); - // uncomment the next two lines if you want to start Jetty with WebSocket (JSR-356) support - // you need org.apache.wicket:wicket-native-websocket-javax in the classpath! - // ServerContainer serverContainer = WebSocketServerContainerInitializer.configureContext(bb); - // serverContainer.addEndpoint(new WicketServerEndpointConfig()); - -// bb.getSessionHandler().setSessionCache(sessionCache); - ServletContextHandler contextHandler = ServletContextHandler.getServletContextHandler(bb.getServletContext()); JakartaWebSocketServletContainerInitializer.configure(contextHandler, (servletContext, container) -> container.addEndpoint(new WicketServerEndpointConfig())); // uncomment next line if you want to test with JSESSIONID encoded in the urls - // ((AbstractSessionManager) - // bb.getSessionHandler().getSessionManager()).setUsingCookies(false); + // bb.getSessionHandler().setUsingCookies(false); server.setHandler(bb); diff --git a/pom.xml b/pom.xml index 06dcc866063..d3ba0a65177 100644 --- a/pom.xml +++ b/pom.xml @@ -215,6 +215,7 @@ 3.6.3 3.2.8 3.2.0 + 3.10.1 3.5.1 3.12.0 3.9.0 @@ -1086,6 +1087,11 @@ maven-install-plugin ${maven-install-plugin.version} + + org.apache.maven.plugins + maven-invoker-plugin + ${maven-invoker-plugin.version} + org.apache.maven.plugins maven-jar-plugin From 0770c2a83a219ccf9d30786bef5c9d4edb2718bb Mon Sep 17 00:00:00 2001 From: Martijn Dashorst Date: Tue, 13 Oct 2026 13:47:04 +0200 Subject: [PATCH 3/3] Express the quickstart's HTTP idle timeout as a Duration The previous commit turned the idle timeout back into 1000 * 60 * 60, undoing the Duration the original port introduced. Duration.ofHours(1) states the intent more plainly; toMillis() is passed as is, because setIdleTimeout takes a long and needs no cast to int. The timeout stays one hour, and the HTTPS connector keeps its own value. GitHub issue #1658 Generated-by: Claude Code (Claude Opus 5.5) --- .../resources/archetype-resources/src/test/java/Start.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/archetypes/quickstart/src/main/resources/archetype-resources/src/test/java/Start.java b/archetypes/quickstart/src/main/resources/archetype-resources/src/test/java/Start.java index 22190208bed..d933d94c4f7 100644 --- a/archetypes/quickstart/src/main/resources/archetype-resources/src/test/java/Start.java +++ b/archetypes/quickstart/src/main/resources/archetype-resources/src/test/java/Start.java @@ -17,6 +17,7 @@ package ${package}; import java.lang.management.ManagementFactory; +import java.time.Duration; import javax.management.MBeanServer; @@ -59,7 +60,7 @@ public static void main(String[] args) throws Exception ServerConnector http = new ServerConnector(server, new HttpConnectionFactory(http_config)); http.setPort(8080); - http.setIdleTimeout(1000 * 60 * 60); + http.setIdleTimeout(Duration.ofHours(1).toMillis()); server.addConnector(http);