# Test if it is sourced or not
if [[ $0 != .*bash ]]; then
    echo Please source it: . $0
    exit 1
fi
res=`gradle --version >/dev/null 2>&1; echo $? `        
if [[ $res == "0" ]]; then
    echo Have gradle: `which gradle`
    gradle --version
else
    export GRADLE_HOME=~/opt/gradle
    export PATH=$PATH:$GRADLE_HOME/bin
    echo No Gradle, adding - `which gradle`   
    gradle --version
fi