blob: 2d459d03ba8a8a4308dca2c0b9755a27bb5bd0fe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#!/bin/bash
## Will update POM in workspace with release version
if [ ! -e version.properties ]; then
echo "Missing version.properties"
exit 1
fi
## will setup variable release_version
source ./version.properties
RELEASE_VERSION=$release_version
echo Changing POM version to $RELEASE_VERSION
## handle POM
for file in $(find . -name pom.xml); do
VERSION=$(xpath -q -e '//project/version/text()' $file)
PVERSION=$(xpath -q -e '//project/parent/version/text()' $file)
echo before changes VERSION=$VERSION PVERSION=$PVERSION file=$file
if [ "$VERSION" != "" ]; then
awk -v v=$RELEASE_VERSION '
/<version>/ {
if (! done) {
sub(/<version>.*</,"<version>" v "<",$0)
done = 1
}
}
{ print $0 }
' $file > $file.tmp
mv $file.tmp $file
fi
if [ "$PVERSION" != "" ]; then
awk -v v=$RELEASE_VERSION '
/<version>/ {
if (parent && ! done) {
sub(/<version>.*</,"<version>" v "<",$0)
done = 1
}
}
/<parent>/ { parent = 1 }
{ print $0 }
' $file > $file.tmp
mv $file.tmp $file
fi
VERSION=$(xpath -q -e '//project/version/text()' $file)
PVERSION=$(xpath -q -e '//project/parent/version/text()' $file)
echo after changes VERSION=$VERSION PVERSION=$PVERSION file=$file
done
|