diff options
author | gjoranv <gv@oath.com> | 2018-11-05 13:15:34 +0100 |
---|---|---|
committer | gjoranv <gv@oath.com> | 2018-11-05 13:23:30 +0100 |
commit | a8cc3048439a6c9d71767dc608fc2541dc954cec (patch) | |
tree | 8322277704538d1203d8f35c87e1e391b5bd8a40 | |
parent | 0e3add6b08f2a061018aedf59ac7883574867e92 (diff) |
Add optional env vars for maven command and extra opts.
-rwxr-xr-x | bootstrap.sh | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/bootstrap.sh b/bootstrap.sh index 6cdcc17400c..0f3faa63386 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -25,8 +25,24 @@ else exit 1 fi +get_env_var_with_optional_default() { + local var_name=$1 + local default_val=$2 + eval "existing_value=\${$var_name}" + if [ "$existing_value" ]; then + echo "$existing_value" + elif [ $# -ge 2 ]; then + echo "$default_val" + fi +} + +readonly MAVEN_CMD=$(get_env_var_with_optional_default VESPA_MAVEN_COMMAND mvn) +readonly MAVEN_EXTRA_OPTS=$(get_env_var_with_optional_default VESPA_MAVEN_EXTRA_OPTS) +echo "Using maven command: ${MAVEN_CMD}" +echo "Using maven extra opts: ${MAVEN_EXTRA_OPTS}" + mvn_install() { - mvn --quiet --batch-mode --no-snapshot-updates clean install -Dmaven.javadoc.skip=true "$@" + ${MAVEN_CMD} --quiet --batch-mode --no-snapshot-updates clean install -Dmaven.javadoc.skip=true ${MAVEN_EXTRA_OPTS} "$@" } # Generate vtag map |