Skip to content

Commit

Permalink
Merge remote branch 'fork/22'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Feb 21, 2015
2 parents af399b2 + 557b3bf commit 0ea9b26
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions jvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ _jvm_set-java-path() {
export PATH="${JAVA_HOME}/bin:$PATH"
}

_jvm-discover-and-set() {
_jvm-find-version() {
if [ -f pom.xml ]; then
local version="$(\
grep '<java.version>' pom.xml | \
Expand All @@ -29,6 +29,11 @@ _jvm-discover-and-set() {
if [ -z "$version" ] && [ -f ~/.java-version ]; then
local version="$(cat ~/.java-version)"
fi
echo "$version"
}

_jvm-discover-and-set() {
local version="$(_jvm-find-version)"
[ ! -z "$version" ] && _jvm_set-java-path "$version"
}

Expand All @@ -45,8 +50,11 @@ jvm() {
echo "$@" > ~/.java-version
_jvm-discover-and-set
;;
version)
_jvm-find-version
;;
*)
echo "Usage: jvm (local|global) <args>"
echo "Usage: jvm (local|global|version) <args>"
return 0
;;
esac
Expand Down

0 comments on commit 0ea9b26

Please sign in to comment.