commit 7e5bc48b812f30cd533226029d940591c0348ef3 Author: Mikolaj Izdebski mizdebsk@redhat.com Date: Mon Jul 30 13:22:11 2012 +0200
Implement _pom_inject_gaid()
scripts/pom_editor.sh | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) --- diff --git a/scripts/pom_editor.sh b/scripts/pom_editor.sh index e84b7c1..219e4c2 100644 --- a/scripts/pom_editor.sh +++ b/scripts/pom_editor.sh @@ -190,6 +190,30 @@ EOF }
+# Add a new XML element referencing given artifact. +# $1 - XPath of parent node +# $2 - groupId:artifactId[:version[:scope]] +# $3 - POM location pattern +# $4 - XML tag name +# $5 - additional XML contents +_pom_inject_gaid() +{ + local xml=$(awk ' +BEGIN { FS=":" } + +{ + if (!$3) { $3="any" } + if (!$4) { $4="compile" } + print "<groupId>" $1 "</groupId>" + print "<artifactId>" $2 "</artifactId>" + print "<version>" $3 "</version>" + print "<scope>" $4 "</scope>" +}' <<<"${2}") + + _pom_inject_xpath "${3}" "${1}" "<${4}> ${xml} ${5} </${4}>" +} + + pom_remove_dep() { set +x