-
Notifications
You must be signed in to change notification settings - Fork 50
/
deploy.sh
118 lines (105 loc) · 3.34 KB
/
deploy.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/sh
base_dir=$(cd `dirname $0`;pwd)
hadoop_version_array=("2.7.5" "2.8.5" "3.1.0" "3.2.2" "3.3.0")
NORMAL="normal"
INTER="inter"
origin_artifact_version=$(mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec)
deploy_repository_id=""
deploy_repository_url=""
while getopts ":m:h" optname
do
case "$optname" in
"m")
echo "deploy mode is $OPTARG"
OPT="${OPTARG}"
if [ "$OPT" = "$NORMAL" ]; then
# 外部maven 中央仓库
deploy_repository_id="oss"
deploy_repository_url="https://oss.sonatype.org/service/local/staging/deploy/maven2"
elif [ "$OPT" = "$INTER" ]; then
deploy_repository_id="cos-inner-maven-repository"
deploy_repository_url="http://mirrors.tencent.com/repository/maven/QCLOUD_COS"
fi
;;
"h")
echo "-m normal or -m inter"
;;
"?")
echo "Unknow option $OPTARG"
;;
*)
echo "Unknow error"
;;
esac
done
for hadoop_version in ${hadoop_version_array[@]}
do
cd ${base_dir}/dep/${hadoop_version}
prefix="hadoop-cos-${hadoop_version}-${origin_artifact_version}"
pom_file=${prefix}.pom
read groupId artifactId versionId <<< $(mvn -f ${pom_file} -q -Dexec.executable="echo" -Dexec.args='${project.groupId} ${project.artifactId} ${project.version}' --non-recursive exec:exec)
echo ${prefix}
mvn deploy:deploy-file \
-DrepositoryId=${deploy_repository_id} \
-Durl=${deploy_repository_url} \
-Dfile=${prefix}.jar \
-DpomFile=${pom_file}
mvn deploy:deploy-file \
-DrepositoryId=${deploy_repository_id} \
-Durl=${deploy_repository_url} \
-Dpackaging=jar.asc \
-Dfile=${prefix}.jar.asc \
-DgeneratePom=false \
-DgroupId=${groupId} \
-DartifactId=${artifactId} \
-Dversion=${versionId}
mvn deploy:deploy-file \
-DrepositoryId=${deploy_repository_id} \
-Durl=${deploy_repository_url} \
-Dfile=${prefix}-sources.jar \
-Dpackaging=jar \
-Dclassifier=sources \
-DgeneratePom=false \
-DgroupId=${groupId} \
-DartifactId=${artifactId} \
-Dversion=${versionId}
mvn deploy:deploy-file \
-DrepositoryId=${deploy_repository_id} \
-Durl=${deploy_repository_url} \
-Dfile=${prefix}-sources.jar.asc \
-Dpackaging=jar.asc \
-Dclassifier=sources \
-DgeneratePom=false \
-DgroupId=${groupId} \
-DartifactId=${artifactId} \
-Dversion=${versionId}
mvn deploy:deploy-file \
-DrepositoryId=${deploy_repository_id} \
-Durl=${deploy_repository_url} \
-Dfile=${prefix}-javadoc.jar \
-Dpackaging=jar \
-Dclassifier=javadoc \
-DgeneratePom=false \
-DgroupId=${groupId} \
-DartifactId=${artifactId} \
-Dversion=${versionId}
mvn deploy:deploy-file \
-DrepositoryId=${deploy_repository_id} \
-Durl=${deploy_repository_url} \
-Dfile=${prefix}-javadoc.jar.asc \
-Dpackaging=jar.asc \
-Dclassifier=javadoc \
-DgeneratePom=false \
-DgroupId=${groupId} \
-DartifactId=${artifactId} \
-Dversion=${versionId}
mvn deploy:deploy-file \
-DrepositoryId=${deploy_repository_id} \
-Durl=${deploy_repository_url} \
-Dpackaging=pom.asc \
-Dfile=${prefix}.pom.asc \
-DgeneratePom=false \
-DgroupId=${groupId} \
-DartifactId=${artifactId} \
-Dversion=${versionId}
done