Skip to content

Commit d8076ed

Browse files
committed
chore: update to work around NPE
1 parent cd18de1 commit d8076ed

File tree

1 file changed

+49
-2
lines changed

1 file changed

+49
-2
lines changed

script/version_snapshot.sh

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,53 @@
11
#!/bin/sh
22

3-
mvn -B versions:set -DnewVersion=`sed -n 's/^parent.version=//p' snapshot.properties` -DartifactId=parent
3+
PARENT_VERSION=`sed -n 's/^parent.version=//p' snapshot.properties`
4+
MODULE_VERSION=`sed -n 's/^module.version=//p' snapshot.properties`
5+
PARENT_VERSION_DEFAULT="1-SNAPSHOT"
6+
MODULE_VERSION_DEFAULT="1.0.0-SNAPSHOT"
7+
GROUP_ID="org.jsonurl"
8+
M2_REPO="$HOME/.m2/repository/org/jsonurl"
49

5-
mvn -B versions:set -DnewVersion=`sed -n 's/^module.version=//p' snapshot.properties` -DartifactId='*' -DprocessParent=false
10+
test -d "$M2_REPO" && rm -fr "$M2_REPO" && echo "removed files from m2"
11+
12+
#
13+
# install the parent so that 1-SNAPSHOT is still available for the
14+
# children after I change the parent's version
15+
#
16+
(cd module && mvn -B install || exit 1) || exit 1
17+
18+
#
19+
# set the project version of the parent
20+
# the ``cd'' is necessary to bypass a NPE in the maven versions plugin
21+
#
22+
(cd module && mvn -B versions:set \
23+
-DnewVersion="$PARENT_VERSION" \
24+
-DgroupId="$GROUP_ID" \
25+
-DartifactId='parent' \
26+
-DoldVersion="$PARENT_VERSION_DEFAULT" \
27+
-DprocessProject=true \
28+
-DprocessParent=false \
29+
|| exit 1) || exit 1
30+
31+
#
32+
# install the parent again so the new version is available for the call to
33+
# ``update-parent'' below
34+
#
35+
(cd module && mvn -B install || exit 1) || exit 1
36+
37+
# set the parent version for all modules
38+
mvn -B versions:update-parent \
39+
-DparentVersion="$PARENT_VERSION" \
40+
-DallowSnapshots=true || exit 1
41+
42+
# set the project version for all modules
43+
mvn -B versions:set \
44+
-DnewVersion="$MODULE_VERSION" \
45+
-DgroupId="$GROUP_ID" \
46+
-DartifactId='*' \
47+
-DoldVersion="$MODULE_VERSION_DEFAULT" \
48+
-DprocessAllModules=true \
49+
-DprocessProject=true \
50+
-DprocessParent=false || exit 1
51+
52+
test -d "$M2_REPO" && rm -fr "$M2_REPO" && echo "removed files from m2"
653

0 commit comments

Comments
 (0)