File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -293,9 +293,31 @@ xpath() {
293
293
xmllint --xpath " $xpath " " $xmlFile " | sed -E ' s/^[^>]*>(.*)<[^<]*$/\1/'
294
294
}
295
295
296
+ # For the given GAV ($1), recursively gets the value of the
297
+ # specified XPath expression of the form "//$2/$3/$4/...".
298
+ pomValue () {
299
+ local pomPath=" $( pom " $1 " ) "
300
+ shift
301
+ local value=" $( xpath " $pomPath " $@ ) "
302
+ if [ " $value " ]
303
+ then
304
+ echo " $value "
305
+ else
306
+ # Path not found in POM; look in the parent POM.
307
+ local pg=" $( xpath " $pomPath " project parent groupId) "
308
+ if [ " $pg " ]
309
+ then
310
+ # There is a parent POM declaration in this POM.
311
+ local pa=" $( xpath " $pomPath " project parent artifactId) "
312
+ local pv=" $( xpath " $pomPath " project parent version) "
313
+ pomValue " $pg :$pa :$pv " $@
314
+ fi
315
+ fi
316
+ }
317
+
296
318
# Gets the SCM URL for the given GAV.
297
319
scmURL () {
298
- xpath " $( pom " $1 " ) " project scm connection | sed -E ' s/.*> scm:git:(.*)<.*/\1 /'
320
+ pomValue " $1 " project scm connection | sed -E ' s/^ scm:git:/ /'
299
321
}
300
322
301
323
# Gets the SCM tag for the given GAV.
You can’t perform that action at this time.
0 commit comments