@@ -78,11 +78,24 @@ checkstyle {
7878
7979sonar {
8080 properties {
81- property(" sonar.projectKey" , " sapiens2000-dev_simple-sns " )
82- property(" sonar.organization" , " sapiens2000-dev " )
81+ property(" sonar.projectKey" , " prgrms-web-devcourse-final-project_WEB3_4_Log4U_BE " )
82+ property(" sonar.organization" , " prgrms-web-devcourse-final-project " )
8383 property(" sonar.host.url" , " https://sonarcloud.io" )
84- property(" sonar.coverage.jacoco.xmlReportPaths" , " build/reports/jacoco/test/jacocoTestReport.xml" )
85- property(" sonar.java.checkstyle.reportPaths" , " build/reports/checkstyle/main.xml" )
86- property(" sonar.branch.name" , System .getenv(" BRANCH_NAME" ) ? : " main" )
84+
85+ // Jacoco 리포트가 존재하는지 확인 후 적용
86+ val jacocoReportPath = file(" build/reports/jacoco/test/jacocoTestReport.xml" )
87+ if (jacocoReportPath.exists()) {
88+ property(" sonar.coverage.jacoco.xmlReportPaths" , jacocoReportPath.absolutePath)
89+ }
90+
91+ // Checkstyle 리포트가 존재하는지 확인 후 적용
92+ val checkstyleReportPath = file(" build/reports/checkstyle/main.xml" )
93+ if (checkstyleReportPath.exists()) {
94+ property(" sonar.java.checkstyle.reportPaths" , checkstyleReportPath.absolutePath)
95+ }
96+
97+ // 환경 변수 `BRANCH_NAME`이 없을 경우 "main"으로 설정
98+ val branchName = System .getenv(" BRANCH_NAME" ) ? : " main"
99+ property(" sonar.branch.name" , branchName)
87100 }
88101}
0 commit comments