DevOps Classroom notes 11/Sep/2025

Building, Unit Testing and packaging Java code

  • We will build the java code using maven
    • compile:
      • we will check the target folder to find .class files
    • test:
      • we will check the target folder for test results
    • package
      • we will check the target folder for package
  • Springpetclinic
  • To build this lets install jdk 21 and maven 3.9.11
  • jdk frameworks
    • openjdk
    • oracle jdk
    • amazon correto
    • eclpise temurin
  • Lets use eclipse temurin
sudo apt update
sudo apt install -y wget apt-transport-https
echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print $2}' /etc/os-release) main" | sudo tee /etc/apt/sources.list.d/adoptium.list
sudo mkdir -p /etc/apt/keyrings
wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | sudo tee /etc/apt/keyrings/adoptium.asc
sudo apt update
sudo apt install -y temurin-21-jdk
java --version

  • Now lets install maven
wget https://dlcdn.apache.org/maven/maven-3/3.9.11/binaries/apache-maven-3.9.11-bin.tar.gz -P /tmp
sudo tar -xf /tmp/apache-maven-3.9.11-bin.tar.gz -C /opt
sudo ln -sfn /opt/apache-maven-3.9.11 /opt/maven
  • Now create a profile script for maven at /etc/profile.d/maven.sh with the following content
export JAVA_HOME=/usr/lib/jvm/temurin-21-jdk-amd64
export M2_HOME=/opt/maven
export MAVEN_HOME=/opt/maven
export PATH=${M2_HOME}/bin:${PATH}
  • Execute
source /etc/profile.d/maven.sh
mvn --version
  • Lets clone the code
git clone https://github.com/dummyrepos/spring-petclinic-sep25.git
cd spring-petclinic-sep25
  • Now compile the code
mvn compile
  • Now clean and run the tests
mvn clean test
  • Now clean and create the package
mvn clean package
  • Github Actions free plan for Github Runners
Feature Limit under Free plan (public repos)
Free minutes / usage cost Usage is free & unlimited for workflows using standard GitHub-hosted runners on public repositories. (GitHub Docs)
Concurrent jobs (total, non-macOS) 20 concurrent jobs on non-macOS runners. (GitHub Docs)
Concurrent macOS jobs 5 concurrent macOS jobs. (GitHub Docs)
Job execution time limit Each job can run up to 6 hours before being terminated. (GitHub Docs)
Workflow run queue limits / event trigger rates e.g. up to 1,500 triggering events per 10 seconds per repository, up to 500 workflow runs queued per 10 seconds. (GitHub Docs)
Workflow run time / gate approval wait time A workflow run may run for up to 35 days, and gate approval can wait up to 30 days. (GitHub Docs)
  • Installing softwares in Github hosted runners

  • Refer Here for pull request workflow created in github actions
  • Now create a pull request to test the workflow
  • Lets update the workflow to use actions from market place

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube