From d1300cac0fbfb4d556764dea32fa47f16b15e903 Mon Sep 17 00:00:00 2001
From: Chen Liang <liangc13@cardiff.ac.uk>
Date: Mon, 7 Apr 2025 06:59:25 +0000
Subject: [PATCH] Update build.gradle

---
 build.gradle | 25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)

diff --git a/build.gradle b/build.gradle
index 4221bd2..e974279 100644
--- a/build.gradle
+++ b/build.gradle
@@ -2,7 +2,7 @@ plugins {
     id 'java'
     id 'org.springframework.boot' version '3.3.5'
     id 'io.spring.dependency-management' version '1.1.6'
-    id 'jacoco' 
+    id 'jacoco' // 引入 JaCoCo 插件
 }
 
 group = 'com.cardiff.client_project'
@@ -44,24 +44,11 @@ dependencies {
     testImplementation group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '4.1.0'
 }
 
-tasks.named('test') {
-    useJUnitPlatform()
-}
-
-
-jacoco {
-    toolVersion = '0.8.7' 
+// 确保不会重复创建任务
+tasks.named('jacocoTestReport').configure {
+    // 任务配置
 }
 
-task jacocoTestReport(type: JacocoReport) {
-    dependsOn test
-
-    reports {
-        xml.enabled true
-        html.enabled true
-    }
-
-    sourceDirectories = files("src/main/java")
-    classDirectories = files("build/classes/java/main")
-    executionData = files("build/jacoco/test.exec")
+tasks.named('test') {
+    useJUnitPlatform()
 }
-- 
GitLab