Chinese Yellow Pages | Classifieds | Knowledge | Tax | IME

Install gradle ( on debian 10)

Follow https://linux4one.com/how-to-install-gradle-on-debian-10/

download latest gradle at: https://gradle.org/releases/
for example:
wget https://services.gradle.org/distributions/gradle-6.2.1-bin.zip -P /tmp
sudo unzip -d /opt/gradle /tmp/gradle-6.2.1.zip
sudo nano /etc/profile.d/gradle.sh
export GRADLE_HOME=/opt/gradle/gradle-6.2.1
export PATH=${GRADLE_HOME}/bin:${PATH}
sudo chmod +x /etc/profile.d/gradle.sh
source /etc/profile.d/gradle.sh
gradle -v

 

Try gradle demo

Follow https://guides.gradle.org/building-java-applications/

mkdir demo
cd demo
gradle init   # setup gralde project struct etc.
most likely we need to modify build.gradle to add some dependence pkg.

./gradlew build
./gradlew tasks
./gradlew run

 

Gradle vs Gradle wrapper

Using the wrapper guarantees that every developer on your team is using the same version of Gradle and that they can run Gradle builds

(even if they haven’t installed Gradle on their machine).

Run gradle wrapper and you are done! You can add the --gradle-version X.Yargument to specify which version of Gradle to use.

The gradle/wrapper/gradle-wrapper.properties specify the real gradle version:

cat gradle/wrapper/gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

 

References:

https://medium.com/@bherbst/understanding-the-gradle-wrapper-a62f35662ab7