Skip to content

Commit

Permalink
Support for JAVA_HOME and java opts via -D*.
Browse files Browse the repository at this point in the history
  • Loading branch information
dstreev committed Sep 24, 2020
1 parent 55345d8 commit 01d329e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
8 changes: 7 additions & 1 deletion hive-sre/bin/hive-sre
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ if [[ ! -d ${HOME}/.hive-sre/cust ]]; then
mkdir -p ${HOME}/.hive-sre/cust
fi

if [ ! -z ${JAVA_HOME} ]; then
JAVA="${JAVA_HOME}/bin/java"
else
JAVA=java
fi

if [[ -f ./hive-sre && "${APP_DIR}" != "${CURR_DIR}" && "${APP_DIR}" != "." ]]; then
echo "Appears you are referencing a previously installed 'hive-sre' while "
Expand Down Expand Up @@ -112,7 +117,8 @@ if [[ "${PRG_ARGS}x" != "x" ]]; then
echo "PRG_ARGS=${PRG_ARGS}"
fi

$(${JAVA} -version)

CLI_CMD="${CLI_CMD}java -cp ${CMD_CP} ${APP_JAVA_OPTS} com.streever.hive.Sre ${PRG_ARGS}"
CLI_CMD="${JAVA} -cp ${CMD_CP} ${APP_JAVA_OPTS} com.streever.hive.Sre ${PRG_ARGS}"

eval "${CLI_CMD}"
11 changes: 9 additions & 2 deletions hive-sre/bin/hive-sre-cli
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ fi
PRG_ARGS=
CMD_CP=

if [ ! -z ${JAVA_HOME} ]; then
JAVA="${JAVA_HOME}/bin/java"
else
JAVA=java
fi

if [[ -f ./hive-sre-shaded.jar ]]; then
# Look in Current Directory
CMD_CP=$APP_DIR/hive-sre-shaded.jar
Expand All @@ -37,7 +43,6 @@ fi
export HADOOP_CONF_DIR="/etc/hadoop/conf"

AUX_LIBS_DIR=${HADOOP_CLI_AUX_LIBS:-${HOME}/.hive-sre/aux_libs}

SHOW_CP=
CMD_DIRECTIVE=
CMD_ARGS=
Expand Down Expand Up @@ -162,6 +167,8 @@ if [[ "${PRG_ARGS}x" != "x" ]]; then
echo "PRG_ARGS=${PRG_ARGS}"
fi

CLI_CMD="${CLI_CMD}java -cp ${CMD_CP} ${APP_JAVA_OPTS} com.streever.hadoop.HadoopShell ${PRG_ARGS}"
$(${JAVA} -version)

CLI_CMD="${JAVA} -cp ${CMD_CP} ${APP_JAVA_OPTS} com.streever.hadoop.HadoopShell ${PRG_ARGS}"

eval "${CLI_CMD}"
4 changes: 2 additions & 2 deletions hive-sre/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.streever.hive</groupId>
<artifactId>hive-sre</artifactId>
<version>2.3.2.3-SNAPSHOT</version>
<version>2.3.2.4-SNAPSHOT</version>

<name>hive</name>

Expand Down Expand Up @@ -55,7 +55,7 @@
<!-- <hadoop.major>3.1</hadoop.major>-->
<!-- <hive.version>3.1.1</hive.version>-->

<hadoop-cli.version>2.2.2.0-SNAPSHOT</hadoop-cli.version>
<hadoop-cli.version>2.2.2.1-SNAPSHOT</hadoop-cli.version>

</properties>

Expand Down

0 comments on commit 01d329e

Please sign in to comment.