forked from wocommunity/wonder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mvn-command
executable file
·58 lines (50 loc) · 1.48 KB
/
mvn-command
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
52
53
54
55
56
57
58
#!/bin/sh
CXREPOURL="http://localhost:8081/repository/maven-snapshots"
function command_help() {
echo "Maven Commands"
echo " deploy-to-cxrepo: Deployment into the CX repository ${CXREPOURL}"
echo " set-version <version>: set project to <version>"
echo " release-prepare <release-version> <new-snapshot-version>"
echo " release-perform <working directory>"
}
function deploy_to_cxrepo() {
mvn clean compile install deploy -DaltDeploymentRepository="nexus::default::${CXREPOURL}"
}
function set_version() {
if [ "$1" == "" ]; then
echo "set-version: new version missing"
else
mvn versions:set -DnewVersion="$1"
echo "If the update succeeded commit the version with 'versions-commit'"
fi
}
function release_prepare() {
if [ "$1" == "" -o "$2" == "" ]; then
echo "release-prepare: release-version or new-snapshot-version missing"
else
mvn release:prepare -DautoVersionSubmodules=true \
-DpushChanges=true \
-DreleaseVersion="$1" \
-DdevelopmentVersion="$2" \
-DupdateWorkingCopyVersions=true
fi
}
function release_perform() {
if [ "$1" == "" ]; then
echo "release-perform: working directory missing"
else
mvn release:perform -DworkingDirectory="$1"
fi
}
function version_commit() {
mvn versions:commit
}
case "$1" in
set-version) set_version "$2";;
versions-commit) version_commit;;
deploy-to-cxrepo) deploy_to_cxrepo;;
release-prepare) release_prepare "$2" "$3";;
release-perform) release_perform "$2";;
help) command_help;;
*) command_help;;
esac