lab1

 4. Installing Maven and Gradle on Ubuntu

A. Installing Maven

Step 1: Update Your System

Open a terminal and run:

sudo apt update sudo

apt upgrade

Step 2: Install Java (if not already installed)

Maven requires Java. Install OpenJDK (for example, version 11):

sudo apt install openjdk-11-jdk java

version

Expected Output (example):

openjdk version "11.0.11" 2021-04-20

OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)

OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)

Step 3: Install Maven

Run the following command:

sudo apt install maven

After installation, check the Maven version:

mvn -version

Expected Output (example):

Apache Maven 3.6.3

Maven home: /usr/share/maven

Java version: 11.0.11, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11- openjdk-amd64

Default locale: en_US, platform encoding: UTF-8

OS name: "linux", version: "5.4.0-xx-generic", arch: "amd64", family: "unix"

B. Installing Gradle

Gradle can be installed in two primary ways: via the Ubuntu repositories (which may not be

the latest version) or by manually installing the latest version.

Option 1: Install from Ubuntu Repositories

sudo apt install gradle gradle

v

Screenshot Tip: Capture the terminal output of gradle -v.

Option 2: Install the Latest Version Manually (Recommended)

1. Download Gradle:

wget https://services.gradle.org/distributions/gradle-8.0-bin.zip

2. Unzip the Downloaded File:

sudo unzip -d /opt/gradle gradle-8.0-bin.zip

3. Set Up the Environment Variables: Add Gradle to your system PATH by appending

the following line to your ~/.bashrc (or ~/.profile):

echo "export PATH=\$PATH:/opt/gradle/gradle-8.0/bin" >> ~/.bashrc source

~/.bashrc

4. Verify the Installation:

gradle -v

Expected Output (example):

Gradle 8.0

Build time:

Revision:

Kotlin:

Groovy:

2022-05-03 12:00:00 UTC

<revision-hash>

1.6.x

3.0.x

Ant: Apache Ant(TM) version 1.10.x compiled on ...

JVM: 11.0.11 (Ubuntu 11.0.11+9-Ubuntu-0ubuntu2.20.04) OS:

Linux 5.4.0-xx-generic amd64

Comments

Popular posts from this blog

lab2

lab4