This is an automated email from the ASF dual-hosted git repository.
dashorst pushed a commit to branch wicket-9.x
in repository https://gitbox.apache.org/repos/asf/wicket.git
The following commit(s) were added to refs/heads/wicket-9.x by this push:
new 3b4d7db35d Port build-versions.py to Python 3 and read its modules
from the poms
3b4d7db35d is described below
commit 3b4d7db35d1dcbf347d181c011838cdf3e57d6de
Author: Martijn Dashorst <[email protected]>
AuthorDate: Fri Oct 23 16:24:59 2026 +0200
Port build-versions.py to Python 3 and read its modules from the poms
release.sh builds release.properties for release:prepare from the
output of build-versions.py, which gives every module its release
version and the next development version. The script was Python 2
behind #!/usr/bin/python, so where python is Python 3 release.sh
stopped there with a SyntaxError.
Its module list was also incomplete. It read the <modules> of the root
pom and of wicket-native-websocket only, derived artifact IDs from
directory names and always added wicket-experimental under the
org.apache.wicket.experimental.wicket8 groupId. The modules under
wicket-experimental were missing (wicket-metrics, and on 9.x and 8.x
wicket-http2 and its submodules), and wicket-experimental itself was
listed twice, under two wrong groupIds. The release plugin then fell
back to prompting or its own default for those modules.
The script now runs on Python 3 and walks the <modules> tree from the
root pom, taking the groupId and artifactId each pom declares. Its
output matches the reactor: 34 modules on master. Adding or removing a
module no longer needs a change to the script.
GitHub issue #1708
Generated-by: Claude Code (Claude Opus 5.5)
(cherry picked from commit 8d0bfa19cc0fc27e918bfa5fd96975590cef4c70)
---
build-versions.py | 39 +++++++++++++++++++--------------------
1 file changed, 19 insertions(+), 20 deletions(-)
diff --git a/build-versions.py b/build-versions.py
index 3f6ae085d2..d5a5e56df3 100755
--- a/build-versions.py
+++ b/build-versions.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
#
# prints a release.properties file for instructing the Maven Release Plugin
# to generate the proper release artefacts without having to manually version
@@ -13,16 +13,17 @@
#
# Example:
#
-# build-milestone.py 7.0.0-M1 7.0.0-SNAPSHOT
+# build-versions.py 7.0.0-M1 7.0.0-SNAPSHOT
#
+import os
import sys
-from xml.dom.minidom import parse
+import xml.etree.ElementTree as ET
-groupId = "org.apache.wicket"
+NS = {"pom": "http://maven.apache.org/POM/4.0.0"}
if len(sys.argv) != 3:
- print "Usage: %s <release-version> <dev-version>" % sys.argv[0]
+ print("Usage: %s <release-version> <dev-version>" % sys.argv[0])
sys.exit(1)
relVersion = sys.argv[1]
@@ -31,27 +32,25 @@ devVersion = sys.argv[2]
relVersions = []
devVersions = []
-def addVersions(groupId, module):
- relVersions.append("project.rel." + groupId + "\\:" + module + "=" +
relVersion)
- devVersions.append("project.dev." + groupId + "\\:" + module + "=" +
devVersion)
+def addVersions(groupId, artifactId):
+ relVersions.append("project.rel." + groupId + "\\:" + artifactId + "=" +
relVersion)
+ devVersions.append("project.dev." + groupId + "\\:" + artifactId + "=" +
devVersion)
-def getModulesFromParent(parentPomFile):
- pom = parse(parentPomFile)
+def addModule(directory):
+ pom = ET.parse(os.path.join(directory, "pom.xml")).getroot()
- for moduleTag in pom.getElementsByTagName('module'):
- module = moduleTag.childNodes[0].nodeValue.replace("testing/",
"").replace("archetypes/quickstart", "wicket-archetype-quickstart")
- addVersions(groupId, module)
+ groupId = pom.findtext("pom:groupId", namespaces=NS) or
pom.findtext("pom:parent/pom:groupId", namespaces=NS)
+ addVersions(groupId, pom.findtext("pom:artifactId", namespaces=NS))
-addVersions(groupId, "wicket-parent")
-addVersions("org.apache.wicket.experimental.wicket8", "wicket-experimental")
+ for module in pom.iterfind(".//pom:modules/pom:module", NS):
+ addModule(os.path.join(directory, module.text))
-getModulesFromParent("pom.xml")
-getModulesFromParent("wicket-native-websocket/pom.xml")
+addModule(".")
for version in relVersions:
- print version
+ print(version)
-print
+print()
for version in devVersions:
- print version
+ print(version)