Skip to content
This repository was archived by the owner on Mar 23, 2023. It is now read-only.

Commit e1861d8

Browse files
committed
set-versions: Drop usage of Maven commands, edit pom.xml directly instead
This script does not use the Maven `versions` plugin (with goals such as `versions:update-parent`, `versions:update-child-modules`, or `versions:set`) because running Maven requires that the *current* versions are all correct and existing (available for download or installed locally). We have frequently found that this is a limitation, because some times it is needed to update from an unexisting version (like if some component is skipping a patch number, during separate development of different modules), or when doing a Release (when the release version is not yet available). It ends up being less troublesome to just edit the pom.xml directly.
1 parent b33a2d5 commit e1861d8

File tree

1 file changed

+51
-21
lines changed

1 file changed

+51
-21
lines changed

bin/set-versions.sh

+51-21
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,22 @@
66
#/ versions to the one provided as argument.
77
#/
88
#/
9+
#/ Notice
10+
#/ ======
11+
#/
12+
#/ This script does not use the Maven `versions` plugin (with goals such as
13+
#/ `versions:update-parent`, `versions:update-child-modules`, or `versions:set`)
14+
#/ because running Maven requires that the *current* versions are all correct
15+
#/ and existing (available for download or installed locally).
16+
#/
17+
#/ We have frequently found that this is a limitation, because some times it is
18+
#/ needed to update from an unexisting version (like if some component is
19+
#/ skipping a patch number, during separate development of different modules),
20+
#/ or when doing a Release (when the release version is not yet available).
21+
#/
22+
#/ It ends up being less troublesome to just edit the pom.xml directly.
23+
#/
24+
#/
925
#/ Arguments
1026
#/ =========
1127
#/
@@ -40,8 +56,8 @@
4056
set -o errexit -o errtrace -o pipefail -o nounset
4157

4258
# Check dependencies.
43-
command -v mvn >/dev/null || {
44-
echo "ERROR: 'mvn' is not installed; please install it"
59+
command -v xmlstarlet >/dev/null || {
60+
echo "ERROR: 'xmlstarlet' is not installed; please install it"
4561
exit 1
4662
}
4763

@@ -131,25 +147,39 @@ function git_add() {
131147
# Apply version
132148
# =============
133149

134-
MVN_ARGS=()
135-
136-
if [[ "$CFG_RELEASE" == "true" ]]; then
137-
MVN_ALLOW_SNAPSHOTS="false"
138-
else
139-
MVN_ALLOW_SNAPSHOTS="true"
140-
MVN_ARGS+=(-U -Psnapshot)
141-
fi
142-
143-
# Parent version: Update to latest available.
144-
mvn "${MVN_ARGS[@]}" versions:update-parent \
145-
-DgenerateBackupPoms=false \
146-
-DparentVersion="[$VERSION_JAVA,)" \
147-
-DallowSnapshots="$MVN_ALLOW_SNAPSHOTS"
148-
149-
# Children versions: Make them inherit from parent.
150-
mvn "${MVN_ARGS[@]}" versions:update-child-modules \
151-
-DgenerateBackupPoms=false \
152-
-DallowSnapshots="$MVN_ALLOW_SNAPSHOTS"
150+
# Parent: Update to the new version of kurento-java.
151+
xmlstarlet edit -S --inplace \
152+
--update "/_:project/_:parent/_:version" \
153+
--value "$VERSION_JAVA" \
154+
pom.xml
155+
156+
# Children: Make them inherit from the new parent.
157+
CHILDREN=(
158+
kurento-chroma
159+
kurento-crowddetector
160+
kurento-group-call
161+
kurento-hello-world
162+
kurento-hello-world-recording
163+
kurento-hello-world-repository
164+
kurento-magic-mirror
165+
kurento-metadata-example
166+
kurento-one2many-call
167+
kurento-one2one-call
168+
kurento-one2one-call-advanced
169+
kurento-one2one-call-recording
170+
kurento-platedetector
171+
kurento-player
172+
kurento-pointerdetector
173+
kurento-rtp-receiver
174+
kurento-send-data-channel
175+
kurento-show-data-channel
176+
)
177+
for CHILD in "${CHILDREN[@]}"; do
178+
find "$CHILD" -name pom.xml -print0 | xargs -0 -n1 \
179+
xmlstarlet edit -S --inplace \
180+
--update "/_:project/_:parent/_:version" \
181+
--value "$VERSION_JAVA"
182+
done
153183

154184
git_add \
155185
'*pom.xml'

0 commit comments

Comments
 (0)