Posts

pom.xml

  <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0"          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">   <modelVersion>4.0.0</modelVersion>   <groupId>com.example</groupId>   <artifactId>MyMavenApp</artifactId>   <version>1.0-SNAPSHOT</version>   <packaging>jar</packaging>   <properties>     <!-- Java version -->     <maven.compiler.source>17</maven.compiler.source>     <maven.compiler.target>17</maven.compiler.target>     <!-- JUnit and Surefire versions -->     <junit.jupiter.version>5.10.1</junit.jupiter.version>     <surefire.plugin.version>3.0.0-M7<...

exp 6

 /* Log into Jenkins: Open your browser and navigate to your Jenkins URL (e.g., http://localhost:8080 ). Create a New Job:Click "New Item" on the Jenkins dashboard. Enter Item Name: e.g., HelloMaven-CI . Don’t change the project name (if a project with this name already exists then delete the existing project), Select "Freestyle project" and click "OK". */ https://github.com/devops-ds/your-maven-project.git /usr/bin/mvn clean package ansible-playbook -i hosts.ini deploy.yml target/*.jar ls -l /var/lib/jenkins/deployment/

exp 5

 sudo apt update sudo apt upgrade -y sudo apt install ansible -y ansible --version gedit hosts.ini ------------------------------- [local] localhost ansible_connection=local ---------------------------------------------- gedit setup.yml ---------------------------------------------------------------------- --- - name: Basic Server Setup   hosts: local   become: yes # Use privilege escalation (sudo)   tasks:     - name: Update apt cache       apt:         update_cache: yes     - name: Install curl       apt:         name: curl         state: present --------------------------------------------------------------------- #Save and exit the file. sudo ansible-playbook -i hosts.ini setup.yml

exp 4

 sudo apt update sudo apt upgrade -y sudo wget -O /etc/apt/keyrings/jenkins-keyring.asc \   https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key echo "deb [signed-by=/etc/apt/keyrings/jenkins-keyring.asc]" \   https://pkg.jenkins.io/debian-stable binary/ | sudo tee \   /etc/apt/sources.list.d/jenkins.list > /dev/null #  Maven Project: https://github.com/devops-ds/your-maven-project.git # Gradle Project: https://github.com/devops-ds/your-gradle-project.git sudo apt update sudo apt install jenkins -y sudo systemctl start jenkins sudo systemctl enable jenkins sudo systemctl status jenkins # in web browser login to jenkin with the administrator credentials you created during the initial setup. #On the Jenkins dashboard, click "New Item" (or "Create a job" if it's a fresh installation). #Enter an item name (e.g., Maven-GitHub-Freestyle or Gradle-GitHub-Freestyle ). #Select "Freestyle project". #Click "OK". / * In the job confi...

exp 3

 #delete MyMavenApp in folder mvn archetype:generate -DgroupId=com.example -DartifactId=MyMavenApp -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false cd MyMavenApp sudo snap install tree tree gedit pom.xml ------------------------------------------------------------------------------------------ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0"          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">   <modelVersion>4.0.0</modelVersion>   <groupId>com.example</groupId>   <artifactId>MyMavenApp</artifactId>   <version>1.0-SNAPSHOT</version>   <packaging>jar</packaging>   <properties>     <!-- Java version -->     <maven.compi...

exp 2

  sudo apt update sudo apt install openjdk-17-jdk -y java --version sudo update-alternatives --config java # remove gradle (pre existing) gradle -v sudo apt remove gradle -y ls ~/.sdkman sdk uninstall gradle <version?> --force # put the actual version (ex : sdk uninstall gradle 8.13 --force) #install gradle  wget https://services.gradle.org/distributions/gradle-8.14-bin.zip -P /tmp sudo unzip -d /opt/gradle /tmp/gradle-8.14-bin.zip gedit ~/.bashrc export GRADLE_HOME=/opt/gradle/gradle-8.14 export PATH=${GRADLE_HOME}/bin:${PATH} source ~/.bashrc gradle -v # working with gradle  (Groovy DSl) cd ~ mkdir HelloGradleGroovy cd HelloGradleGroovy gradle init --type java-application --dsl groovy --overwrite tree gedit app/build.gradle ---------------------------------------------------------------------------------------------- plugins {       id 'java'       id 'application' } group = 'org.example' version = '1.0' repositories {     ...

exp 1

 sudo apt update sudo apt install openjdk-17-jdk -y java --version sudo update-alternatives --config java # Install maven sudo apt install maven -y mvn -version mvn archetype:generate -DgroupId=com.example -DartifactId=MyMavenApp -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false mkdir MyMavenApp cd MyMavenApp sudo snap install tree tree gedit pom.xml -------------------------------------------------------------------------------------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0"          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">   <modelVersion>4.0.0</modelVersion>   <groupId>com.example</groupId>   <artifactId>MyMavenApp</artifactId>   <version...