diff --git a/libexec/jenv b/libexec/jenv index b83d305..790c90e 100755 --- a/libexec/jenv +++ b/libexec/jenv @@ -44,15 +44,27 @@ shopt -s nullglob -bin_path="$(abs_dirname "$0")" +bin_path="$(abs_dirname "$0")" + + + for plugin_bin in "${JENV_ROOT}/plugins/"*/bin; do bin_path="${bin_path}:${plugin_bin}" -done +done + +for plugin_bin in "$bin_path/../plugins/"*/bin; do + bin_path="${bin_path}:${plugin_bin}" +done + export PATH="${bin_path}:${PATH}" hook_path="${JENV_HOOK_PATH}" for plugin_hook in "${JENV_ROOT}/plugins/"*/etc/jenv.d; do hook_path="${hook_path}:${plugin_hook}" +done + +for plugin_hook in "$bin_path/../plugins/"*/etc/jenv.d; do + hook_path="${hook_path}:${plugin_hook}" done export JENV_HOOK_PATH=$hook_path diff --git a/libexec/jenv-exec b/libexec/jenv-exec index 703a234..2338efb 100755 --- a/libexec/jenv-exec +++ b/libexec/jenv-exec @@ -22,7 +22,9 @@ if [ "$1" = "--complete" ]; then fi export JENV_VERSION="$(jenv-version-name)" -JENV_COMMAND="$1" +JENV_COMMAND="$1" + +export JAVA_HOME="$JENV_ROOT/versions/$JENV_VERSION" if [ -z "$JENV_COMMAND" ]; then jenv-help --usage exec >&2 diff --git a/libexec/jenv-which b/libexec/jenv-which index 882d973..709ac8d 100755 --- a/libexec/jenv-which +++ b/libexec/jenv-which @@ -61,6 +61,11 @@ if [ "$JENV_VERSION" = "system" ]; then JENV_COMMAND_PATH="$(command -v "$JENV_COMMAND" || true)" else JENV_COMMAND_PATH="${JENV_ROOT}/versions/${JENV_VERSION}/bin/${JENV_COMMAND}" + if ! [ -x "$JENV_COMMAND_PATH" ]; then + PATH="$(remove_from_path "${JENV_ROOT}/shims")" + JENV_COMMAND_PATH="$(command -v "$JENV_COMMAND" || true)" + fi + fi for script in $(jenv-hooks which); do