diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 000000000..22793a3d5 Binary files /dev/null and b/.DS_Store differ diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 000000000..330b32b94 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,48 @@ +Vagrant.configure("2") do |config| + # Use the ubuntu/bionic64 box + config.vm.box = "ubuntu/bionic64" + config.vm.boot_timeout = 600000 + + # Configuring VirtualBox provider settings + config.vm.provider "virtualbox" do |vb| + vb.name = "MyVB" + vb.cpus = 2 + vb.memory = "2048" + end + + # Configuring VirtualBox network settings + config.vm.network "forwarded_port", guest: 8080, host: 8086 +~ + # Configuring VirtualBox folder settings + config.vm.synced_folder ".", "/home/vagrant/petclinic" + + # Provisioning with a shell script to run the JAR file + config.vm.provision "shell", inline: <<-SHELL + apt update + apt install -y openjdk-17-jdk git unzip + + APP_DIR="/home/vagrant/petclinic" + REPO_URL="https://github.com/yiting68/spring-petclinic.git" + JAR_NAME="spring-petclinic-3.4.0.jar" + SERVICE_NAME="petclinic"~~ + + # Clone Spring PetClinic project if does not exist + if [ ! -d "$APP_DIR/.git" ]; then + git clone "$REPO_URL" "$APP_DIR" + # Pull latest changes if project already exists + else + cd "$APP_DIR" + git pull + fi + + # Navigate to the project directory + cd "$APP_DIR" + + # Build the JAR file + ./gradlew build + + # Run the JAR file + nohup java -jar build/libs/$JAR_NAME > $APP_DIR/app.log 2>&1 & + + SHELL +end \ No newline at end of file diff --git a/build.gradle b/build.gradle index b52d8e185..bf15feb7f 100644 --- a/build.gradle +++ b/build.gradle @@ -6,6 +6,7 @@ plugins { id 'org.cyclonedx.bom' version '1.10.0' id 'io.spring.javaformat' version '0.0.43' id "io.spring.nohttp" version "0.0.11" + id 'jacoco' } apply plugin: 'java' @@ -25,6 +26,18 @@ repositories { mavenCentral() } + +jacoco { + toolVersion = "0.8.11" // The Latest version +} + +jacocoTestReport { + dependsOn test // Ensures tests run before generating reports + reports { + xml.required = true // Required for CI tools (e.g., SonarQube) + html.required = true // Human-readable HTML report + } +} ext.checkstyleVersion = "10.20.1" ext.springJavaformatCheckstyleVersion = "0.0.43" ext.webjarsLocatorLiteVersion = "1.0.1" @@ -88,3 +101,13 @@ checkFormatAotTest.enabled = false formatAot.enabled = false formatAotTest.enabled = false + +// Custom Build task +task printBuildInfo { + doLast { + println "Hi,we edit here!!" + println "Project: ${project.name}" + println "Version: ${version}" + println "Java Version: ${java.sourceCompatibility}" // Uses sourceCompatibility instead of toolchain + } +} \ No newline at end of file diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 000000000..2f258b4dd Binary files /dev/null and b/src/.DS_Store differ