Skip to content

Commit fecbd70

Browse files
jing10.gaopan3793
authored andcommitted
[KYUUBI #1834] [BUILD] Add support of external mvn with default mvn jvm opts when making distribution
### _Why are the changes needed?_ most of time, we use the mvn pre-installed in the OS ### _How was this patch tested?_ After running the script `build/dist`, it should echo the 'MVN' location before building the release package ```bash build/dist --tgz --name release-demo \ --spark-provided --flink-provided \ --mvn $(which mvn) \ -DskipTests \ -Pjava-8 -Pspark-hadoop-3.2 -Pspark-3.0 ``` Closes #1834 from goldenbean/dev/mvn. Closes #1834 26f13da [jing10.gao] break usage into multi-lines e1d14d3 [jing10.gao] update the usage 954e847 [jing10.gao] external mvn 056c518 [jing10.gao] external mvn Authored-by: jing10.gao <jing10.gao@vipshop.com> Signed-off-by: Cheng Pan <chengpan@apache.org>
1 parent 20d832a commit fecbd70

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

build/dist

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,14 @@ function usage {
4141
echo ""
4242
echo "Usage:"
4343
echo "+--------------------------------------------------------------------------------------+"
44-
echo "| ./build/dist [--name <custom_name>] [--tgz] [--flink-provided] [--spark-provided] <maven build options> |"
44+
echo "| ./build/dist [--name <custom_name>] [--tgz] [--flink-provided] [--spark-provided] |"
45+
echo "| [--mvn <maven_executable>] <maven build options> |"
4546
echo "+--------------------------------------------------------------------------------------+"
4647
echo "name: - custom binary name, using project version if undefined"
4748
echo "tgz: - whether to make a whole bundled package"
4849
echo "flink-provided: - whether to make a package without Flink binary"
4950
echo "spark-provided: - whether to make a package without Spark binary"
51+
echo "mvn: - external maven executable location"
5052
echo ""
5153
}
5254

@@ -68,6 +70,10 @@ while (( "$#" )); do
6870
--spark-provided)
6971
SPARK_PROVIDED=true
7072
;;
73+
--mvn)
74+
MVN="$2"
75+
shift
76+
;;
7177
--name)
7278
NAME="$2"
7379
shift
@@ -112,6 +118,16 @@ if [[ $(command -v git) ]]; then
112118
unset GITREV
113119
fi
114120

121+
122+
if [ ! "$(command -v "$MVN")" ] ; then
123+
echo -e "Could not locate Maven command: '$MVN'."
124+
echo -e "Specify the Maven command with the --mvn flag"
125+
exit -1;
126+
fi
127+
128+
echo "MVN is set to $MVN"
129+
130+
115131
VERSION=$("$MVN" help:evaluate -Dexpression=project.version $@ 2>/dev/null\
116132
| grep -v "INFO"\
117133
| grep -v "WARNING"\
@@ -170,6 +186,7 @@ else
170186
fi
171187

172188
MVN_DIST_OPT="-DskipTests"
189+
173190
if [[ "$SPARK_PROVIDED" == "true" ]]; then
174191
MVN_DIST_OPT="$MVN_DIST_OPT -Pspark-provided"
175192
fi
@@ -178,6 +195,8 @@ if [[ "$FLINK_PROVIDED" == "true" ]]; then
178195
MVN_DIST_OPT="$MVN_DIST_OPT -Pflink-provided"
179196
fi
180197

198+
export MAVEN_OPTS="${MAVEN_OPTS:--Xmx2g}"
199+
181200
BUILD_COMMAND=("$MVN" clean install $MVN_DIST_OPT $@)
182201

183202
echo -e "\nBuilding with..."

0 commit comments

Comments
 (0)