Skip to content

Commit 76df806

Browse files
fix: sonar
1 parent b635ca2 commit 76df806

File tree

2 files changed

+36
-32
lines changed

2 files changed

+36
-32
lines changed

.github/workflows/sonarcloud.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,14 @@ jobs:
3333
restore-keys: ${{ runner.os }}-sonar
3434

3535
- name: Build and test (generate JaCoCo)
36-
run: mvn -B -DskipTests=false verify
36+
run: mvn -B verify -Djacoco.skip=false
37+
38+
# - name: Generate combined report
39+
# run: |
40+
# mkdir -p target/jacoco-merged
41+
# cp domain/target/jacoco.exec target/jacoco-merged/domain.exec
42+
# cp infrastructure/target/jacoco.exec target/jacoco-merged/infra.exec
43+
# mvn jacoco:merge -DfileSets=target/jacoco-merged
3744

3845
- name: SonarCloud analyze (push) - non-blocking
3946
if: github.event_name != 'pull_request'
@@ -45,7 +52,7 @@ jobs:
4552
-Dsonar.host.url=https://sonarcloud.io
4653
-Dsonar.organization=${{ vars.SONAR_ORG }}
4754
-Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }}
48-
-Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml
55+
-Dsonar.coverage.jacoco.xmlReportPaths=target/domain/site/jacoco-aggregate/jacoco.xml
4956
-Dsonar.qualitygate.wait=false
5057
5158
- name: SonarCloud analyze
@@ -58,5 +65,5 @@ jobs:
5865
-Dsonar.host.url=https://sonarcloud.io
5966
-Dsonar.organization=${{ vars.SONAR_ORG }}
6067
-Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }}
61-
-Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml
68+
-Dsonar.coverage.jacoco.xmlReportPaths=target/domain/site/jacoco-aggregate/jacoco.xml
6269
-Dsonar.qualitygate.wait=true

pom.xml

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -51,38 +51,35 @@
5151
<artifactId>maven-surefire-plugin</artifactId>
5252
<version>3.5.2</version>
5353
</plugin>
54+
<plugin>
55+
<groupId>org.jacoco</groupId>
56+
<artifactId>jacoco-maven-plugin</artifactId>
57+
<version>0.8.12</version>
58+
<executions>
59+
<execution>
60+
<id>prepare-agent</id>
61+
<goals>
62+
<goal>prepare-agent</goal>
63+
</goals>
64+
</execution>
65+
<execution>
66+
<id>verify</id>
67+
<phase>verify</phase>
68+
<goals>
69+
<goal>report-aggregate</goal>
70+
</goals>
71+
<configuration>
72+
<dataFileIncludes>
73+
<dataFileInclude>**/jacoco.exec</dataFileInclude>
74+
</dataFileIncludes>
75+
<outputDirectory>${project.reporting.outputDirectory}/jacoco-aggregate</outputDirectory>
76+
</configuration>
77+
</execution>
78+
</executions>
79+
</plugin>
5480
</plugins>
5581
</build>
5682

57-
<profiles>
58-
<profile>
59-
<id>coverage</id>
60-
<build>
61-
<plugins>
62-
<plugin>
63-
<groupId>org.jacoco</groupId>
64-
<artifactId>jacoco-maven-plugin</artifactId>
65-
<executions>
66-
<execution>
67-
<id>prepare-agent</id>
68-
<goals>
69-
<goal>prepare-agent</goal>
70-
</goals>
71-
</execution>
72-
<execution>
73-
<id>report</id>
74-
<phase>prepare-package</phase>
75-
<goals>
76-
<goal>report</goal>
77-
</goals>
78-
</execution>
79-
</executions>
80-
</plugin>
81-
</plugins>
82-
</build>
83-
</profile>
84-
</profiles>
85-
8683
<dependencyManagement>
8784
<dependencies>
8885
<dependency>

0 commit comments

Comments
 (0)