-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.sh
executable file
·48 lines (38 loc) · 1.15 KB
/
setup.sh
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
#!/bin/bash
# read options, will exit if parameters are malformed
temp=`getopt -n 'setup' -o g:s:v: --long group:,serviceName:,version: -- "$@"`
eval set -- "$temp"
# default parameters
group="org.jazzcommunity.example"
serviceName="ExampleService"
version="1.0.0"
# handle optional parameters
while true; do
case "$1" in
-g | --group ) group="$2"; shift; shift;;
-s | --serviceName ) serviceName="$2"; shift; shift;;
-v | --version ) version="$2"; shift; shift;;
-- ) shift; break;;
* ) break;;
esac
done
mvn clean install
if [ $? -ne 0 ]; then
echo "Maven failed, check log"
exit 1
fi
cd target
mvn archetype:generate -B \
"-DarchetypeCatalog=local" \
"-DarchetypeGroupId=org.jazzcommunity.service.archetype" \
"-DarchetypeArtifactId=org.jazzcommunity.service.archetype" \
"-Dversion=$version" \
"-DgroupId=$group" \
"-DartifactId=$group.parent" \
"-Dpackage=$group" \
"-DserviceName=$serviceName"
if [ $? -ne 0 ]; then
echo "Maven failed, check log"
exit 1
fi
cd "$group.parent"