3 # Copyright © 2019 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 # Find modules using JSR 305
10 for module in $(git grep -lf ${0%/*}/jsr305.txt |
11 awk -F/ '{ for (i = NF; i > 0; i--) { if ($i == "src") { NF = i - 1; print; next } } }' OFS="/" |
13 # If they don't already pull in jsr305...
14 if ! grep -q jsr305 ${module}/pom.xml; then
15 # ... add the dependency
16 xmlstarlet ed -P -L -N mvn=http://maven.apache.org/POM/4.0.0 \
17 -s /mvn:project/mvn:dependencies -t elem -n dependencyTMP -v "" \
18 -s //dependencyTMP -t elem -n groupId -v "com.google.code.findbugs" \
19 -s //dependencyTMP -t elem -n artifactId -v "jsr305" \
20 -s //dependencyTMP -t elem -n optional -v "true" \
21 -r //dependencyTMP -v dependency \