Gradle is a software that is used in the development of mobile applications as well as microservices, moreover, Gradle allows its users to build, automate, and test the newly created applications. If you are working on a multi-build project, Gradle continuously looks up the project and the changes you made in the input, according to Gradle change the output. Moreover, the configuration of Gradle is dependent on the Groovy language constructs.
In this write-up, we are going to explore the installation method of Gradle on Ubuntu 22.04.
How to install Gradle on Ubuntu 22.04
To install Gradle on the Ubuntu, we have to first install the Java packages on the Ubuntu using the command:
$ sudo apt install default-jdk -y
To confirm the installation of the Java package, we will check its version:
$ java -version
Java has been installed and Gradle is dependent on the Java that why it is necessary to install the Java, next step is to download the latest release of Gradle package from its official website using the command:
$ wget -c https://services.gradle.org/distributions/gradle-7.4.2-bin.zip -P /tmp
When the package has been downloaded, we will unzip the downloaded file by using the command:
$ sudo unzip -d /opt/gradle /tmp/gradle-7.4.2-bin.zip
We will display the contents of /opt/gradle, to verify the execution of the above command:
$ ls /opt/gradle
Now to setup the environment variables, we will open its “sh” file using the nano text editor:
$ sudo nano /etc/profile.d/gradle.sh
In the open file, add these two line:
export GRADLE_HOME=/opt/gradle/gradle-7.4.2
export PATH=${GRADLE_HOME}/bin:${PATH}
Exit the editor by saving the file and make the file executable by changing its access permissions:
$ sudo chmod +x /etc/profile.d/gradle.sh
Finally, its time to install Gradle on Ubuntu, to do so run the command:
$ source /etc/profile.d/gradle.sh
For the confirmation of the installation of Gradle, we will check its installed version:
$ gradle --version
Conclusion
Gradle is used to build, test, and deploy the different applications whether these are for the small startups or the big enterprises. In this write-up, the installation method of Gradle has been discussed on the latest release of Ubuntu 22.04 using the command line.
Saryia is a professional writer with a passion for simplifying complex topics. Specializing in Linux, programming, and technology, Saryia creates in-depth tutorials and articles designed to educate and empower readers.