1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# 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