Posts

lab6

 2. Setting Up a CI Pipeline with Jenkins (Freestyle Project) This section explains how to create a CI pipeline as a Freestyle project that integrates with a Maven or Gradle project. Step 1: Create a New Jenkins Job 1. Log into Jenkins: o Open your web browser and navigate to your Jenkins URL (e.g., http://localhost:8080 or your cloud instance URL). o Log in with your admin credentials. 2. Create a New Job: o On the Jenkins dashboard, click on “New Item”. o Enter an Item Name: For example, Maven-CI (or Gradle-CI if you prefer Gradle). o Select “Freestyle project”. o Click “OK”. Step 2: Configure Source Code Management (SCM) 1. Select SCM: o In the job configuration page, scroll down to the “Source Code Management” section. o Select “Git” (if using Git for version control). 2. Enter Repository Details: o Repository URL: Enter the URL of your Git repository (for example, https://github.com/yourusername/your-maven-project.git). o Credentials: If your re...

lab5

 2. Installing Jenkins on a Local Machine (Ubuntu) Below are detailed step-by-step instructions for installing Jenkins on an Ubuntu machine. Step 1: Update Your System Open your terminal and update your system repositories: sudo apt update sudo apt upgrade -y Step 2: Install Java Jenkins requires Java to run. It is recommended to use Java 11 or later. Install OpenJDK 11: sudo apt install openjdk-11-jdk -y java version Expected Output Example: openjdk version "11.0.11" 2021-04-20 Step 3: Add the Jenkins Repository Key Download and add the repository key so that your system trusts the Jenkins packages: wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt- key add - Step 4: Add the Jenkins Repository Add the Jenkins repository to your system’s sources list: sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list' Step 5: Update the Repository and Install Jenkins Update the packag...

lab4

 Same Application to Gradle Part A: Build and Run a Java Application with Maven 1. Create the Maven Project 1. Open your Terminal. 2. Generate the Maven Project using the Quickstart Archetype: Type the following command and press Enter: mvn archetype:generate -DgroupId=com.example -DartifactId=HelloMaven - DarchetypeArtifactId=maven-archetype-quickstart DinteractiveMode=false - o What it does: This command creates a new Maven project with the group ID com.example and the artifact ID HelloMaven. The archetype sets up a basic Java application, including a sample test. o Expected Output: Maven will display messages as it downloads dependencies and generates the project files. o Screenshot Tip: Capture the terminal output showing the successful project generation. 3. Change Directory into the Newly Created Project: 4. cd HelloMaven o Screenshot Tip: Capture the output of the pwd or ls command to show the project structure. 2. Explore the Maven Project Structure You...

lab3

 Setting Up a Gradle Project - Step-by-Step Instructions Step 1: Ensure Gradle is Installed Before starting, verify that Gradle is installed on your Ubuntu system. Open a terminal and run: gradle -v If you see version information, you’re set. If not, follow the Gradle installation instructions from Experiment 1. Step 2: Create a New Gradle Project Gradle offers an interactive command to generate a new project using an initialization script. To create a basic Java application project: 1. Create a new directory for your project and navigate to it: 2. mkdir HelloGradle 3. cd HelloGradle 4. Run the Gradle init command: 5. gradle init --type java-application You will be prompted to choose between a few options (if you don’t use the non- interactive mode). Choose defaults or specify details as needed. Step 3: Explore the Project Structure After project creation, the directory structure typically looks like this: HelloGradle/ ├── build.gradle default) ├── gradle/ ...

lab2

 Experiment 2: Working with Also integrates seamlessly with CI/CD tools and is often chosen for its faster build times and flexibility in pipeline scripting. Maven: Creating a Maven Project, Understanding the POM File, Dependency Management and Plugins 1. Introduction to Maven Maven is a powerful build automation and project management tool primarily used for Java projects. It simplifies the build process by: • Enforcing a standard project structure (convention over configuration). • Managing dependencies automatically by downloading them from remote repositories (e.g., Maven Central). • Defining a clear build lifecycle (compile, test, package, install, deploy). • Allowing the integration of various plugins to extend functionality (e.g., testing, reporting). 2. Creating a Maven Project Step-by-Step Process Step 1: Open Your Terminal Make sure you have Maven installed (refer to Experiment 1). Open your terminal on your Ubuntu system. Step 2: Use Maven Archetyp...

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: "u...