|
1 | 1 | #!/bin/sh
|
2 | 2 |
|
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" |
4 | 9 |
|
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" |
6 | 53 |
|
0 commit comments