You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
x -u "/mvn:project/mvn:properties/mvn:codenameone.version" -v "$CN1_VERSION""$ROOT_POM"
144
139
fi
145
140
146
-
# 2) Parent must use a literal version (no properties allowed)
147
-
# Update any pom’s parent if it is CN1 parent
141
+
# 2) Parent must be a LITERAL version (no property allowed)
148
142
while IFS= read -r -d '' P;do
149
-
xmlstarlet ed -L \
150
-
-u "/project[parent/groupId='com.codenameone' and parent/artifactId='codenameone-maven-parent']/parent/version" \
151
-
-v "$CN1_VERSION" \
152
-
"$P"||true
143
+
x -u "/mvn:project[mvn:parent/mvn:groupId='com.codenameone' and mvn:parent/mvn:artifactId='codenameone-maven-parent']/mvn:parent/mvn:version" -v "$CN1_VERSION""$P"||true
153
144
done<<(find "$APP_DIR" -type f -name pom.xml -print0)
154
145
155
-
# 3) For com.codenameone deps/plugins, use the property ${codenameone.version}
156
-
# (Plugins still need a version element present)
146
+
# 3) Point com.codenameone deps/plugins to ${codenameone.version}
# Helper to resolve bash-like ${prop:-fallback} to either ${prop} or literal
192
-
resolve_value() {
193
-
local spec="$1"
194
-
if [[ "$spec"=='${'maven-compiler-plugin.version':-'* ]];then
195
-
# if property exists in the POM, use ${maven-compiler-plugin.version}, otherwise fallback literal
196
-
if xmlstarlet sel -t -v "count(/project/properties/maven-compiler-plugin.version)""$ROOT_POM"| grep -qxE '[1-9]';then
197
-
echo'${maven-compiler-plugin.version}'
198
-
else
199
-
echo"${spec#*\:-}"| tr -d '}'
200
-
fi
201
-
else
202
-
echo"$spec"
171
+
add_version_if_missing() {
172
+
local pom="$1" g="$2" a="$3" v="$4"
173
+
# build/plugins
174
+
if [ "$(q -t -v "count(/mvn:project/mvn:build/mvn:plugins/mvn:plugin[mvn:groupId='$g' and mvn:artifactId='$a']/mvn:version)""$pom"2>/dev/null ||echo 0)"="0" ] &&
175
+
[ "$(q -t -v "count(/mvn:project/mvn:build/mvn:plugins/mvn:plugin[mvn:groupId='$g' and mvn:artifactId='$a'])""$pom"2>/dev/null ||echo 0)"!="0" ];then
176
+
x -s "/mvn:project/mvn:build/mvn:plugins/mvn:plugin[mvn:groupId='$g' and mvn:artifactId='$a']" -t elem -n version -v "$v""$pom"||true
177
+
fi
178
+
# pluginManagement/plugins
179
+
if [ "$(q -t -v "count(/mvn:project/mvn:build/mvn:pluginManagement/mvn:plugins/mvn:plugin[mvn:groupId='$g' and mvn:artifactId='$a']/mvn:version)""$pom"2>/dev/null ||echo 0)"="0" ] &&
180
+
[ "$(q -t -v "count(/mvn:project/mvn:build/mvn:pluginManagement/mvn:plugins/mvn:plugin[mvn:groupId='$g' and mvn:artifactId='$a'])""$pom"2>/dev/null ||echo 0)"!="0" ];then
181
+
x -s "/mvn:project/mvn:build/mvn:pluginManagement/mvn:plugins/mvn:plugin[mvn:groupId='$g' and mvn:artifactId='$a']" -t elem -n version -v "$v""$pom"||true
203
182
fi
204
183
}
205
184
206
185
while IFS= read -r -d '' P;do
207
-
forgain"${!PLUGIN_FALLBACK[@]}";do
208
-
g="${ga%%:*}"; a="${ga##*:}"
209
-
val="$(resolve_value "${PLUGIN_FALLBACK[$ga]}")"
210
-
211
-
# build/plugins: add <version> if missing
212
-
if [ "$(xmlstarlet sel -t -v "count(/project/build/plugins/plugin[groupId='$g' and artifactId='$a']/version)""$P"2>/dev/null ||echo 0)"="0" ] && \
213
-
[ "$(xmlstarlet sel -t -v "count(/project/build/plugins/plugin[groupId='$g' and artifactId='$a'])""$P"2>/dev/null ||echo 0)"!="0" ];then
214
-
xmlstarlet ed -L \
215
-
-s "/project/build/plugins/plugin[groupId='$g' and artifactId='$a']" -t elem -n version -v "$val" \
216
-
"$P"||true
217
-
fi
218
-
219
-
# pluginManagement/plugins: add <version> if missing
220
-
if [ "$(xmlstarlet sel -t -v "count(/project/build/pluginManagement/plugins/plugin[groupId='$g' and artifactId='$a']/version)""$P"2>/dev/null ||echo 0)"="0" ] && \
221
-
[ "$(xmlstarlet sel -t -v "count(/project/build/pluginManagement/plugins/plugin[groupId='$g' and artifactId='$a'])""$P"2>/dev/null ||echo 0)"!="0" ];then
222
-
xmlstarlet ed -L \
223
-
-s "/project/build/pluginManagement/plugins/plugin[groupId='$g' and artifactId='$a']" -t elem -n version -v "$val" \
0 commit comments