3 # Copyright © 2017 Red Hat, Inc. and others.
5 # This program and the accompanying materials are made available under the
6 # terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 # and is available at http://www.eclipse.org/legal/epl-v10.html
9 xmlstarlet sel -N "maven=http://maven.apache.org/POM/4.0.0" -t \
10 -m "maven:project/maven:dependencyManagement/maven:dependencies/maven:dependency" \
11 -v maven:groupId -o " " -v maven:artifactId -o " classifier=" -v maven:classifier -o " type=" -v maven:type \
12 -o " scope=" -v maven:scope -o " version=" -v maven:version -n \
13 ../odlparent/pom.xml |
17 FNR == NR && predeps && /<dependencies>/ {
21 FNR == NR && !predeps && /<\/dependencies>/ {
25 FNR == NR && postdeps {
28 FNR < NR && !/org.opendaylight/ {
29 printf " <dependency>\n"
30 printf " <groupId>%s</groupId>\n", $1
31 printf " <artifactId>%s</artifactId>\n", $2
33 for (i = 3; i <= NF; i++) {
34 equalidx = index($i, "=")
35 if (equalidx != length($i)) {
36 element = substr($i, 1, equalidx - 1)
37 value = substr($i, equalidx + 1)
38 if (element == "scope") {
39 if (value == "import") {
40 # Scope import dependencies need to have their version mentioned explicitly
43 } else if (element != "version" || needversion) {
44 printf " <%s>%s</%s>\n", element, value, element
48 printf " </dependency>\n"
51 ' pom.xml - > pom.xml.new
52 mv pom.xml.new pom.xml