This is an automated email from the ASF dual-hosted git repository.

pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 4081aab2d333 feat(ci): jacoco coverage
4081aab2d333 is described below

commit 4081aab2d3331d51892070f9e0a65696b21948ef
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Wed Jan 14 12:17:35 2026 +0100

    feat(ci): jacoco coverage
    
    It enables the possibility to use coverage metrics from Sonar and any other 
tool
    
    Ref CAMEL-22752
---
 Jenkinsfile    |  6 +++---
 parent/pom.xml | 43 +++++++++++++++++++++++++++++++++++++++++++
 pom.xml        |  8 ++++----
 3 files changed, 50 insertions(+), 7 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 98bc87f48de2..5d3cfd0b25ef 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -19,7 +19,7 @@ def MAVEN_TEST_PARAMS = env.MAVEN_TEST_PARAMS ?: 
"-Dkafka.instance.type=local-st
 def MAVEN_TEST_PARAMS_UBUNTU = env.MAVEN_TEST_PARAMS ?: 
"-Dci.env.name=apache.org"
 /*
 Below parameters are required for camel/core/camel-core module's test cases to 
pass on ppc64 and s390x
-- xpathExprGrpLimit: limits the number of groups an Xpath expression can 
contain 
+- xpathExprGrpLimit: limits the number of groups an Xpath expression can 
contain
 - xpathExprOpLimit: limits the number of operators an Xpath expression can 
contain
 */
 def MAVEN_TEST_PARAMS_ALT_ARCHS = "-Djdk.xml.xpathExprGrpLimit=100 
-Djdk.xml.xpathExprOpLimit=2000"
@@ -146,7 +146,7 @@ pipeline {
                                     if ("${JDK_NAME}" == "jdk_17_latest") {
                                         withCredentials([string(credentialsId: 
'apache-camel-core', variable: 'SONAR_TOKEN')]) {
                                             echo "Code quality review ENABLED 
for ${PLATFORM}"
-                                            sh "./mvnw $MAVEN_PARAMS 
-Dsonar.host.url=https://sonarcloud.io 
-Dsonar.java.experimental.batchModeSizeInKB=2048 -Dsonar.organization=apache 
-Dsonar.projectKey=apache_camel -Dsonar.branch.name=$BRANCH_NAME 
org.sonarsource.scanner.maven:sonar-maven-plugin:sonar"
+                                            sh "./mvnw $MAVEN_PARAMS 
-Dsonar.host.url=https://sonarcloud.io 
-Dsonar.java.experimental.batchModeSizeInKB=2048 -Dsonar.organization=apache 
-Dsonar.projectKey=apache_camel -Dsonar.branch.name=$BRANCH_NAME 
org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Pcoverage"
                                         }
                                     } else {
                                         echo "Code quality review disabled for 
${PLATFORM} with JDK ${JDK_NAME}"
@@ -156,7 +156,7 @@ pipeline {
                                 }
                             }
                         }
-                    }   
+                    }
 
                     stage('Test') {
                         steps {
diff --git a/parent/pom.xml b/parent/pom.xml
index 52f607e95bad..e5aa76791217 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -4346,5 +4346,48 @@
                 </plugins>
             </build>
         </profile>
+
+        <profile>
+            <id>coverage</id>
+            <activation>
+                <property>
+                    <name>coverage</name>
+                </property>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.jacoco</groupId>
+                        <artifactId>jacoco-maven-plugin</artifactId>
+                        <version>0.8.11</version>
+                        <executions>
+                            <execution>
+                                <id>prepare-agent</id>
+                                <goals>
+                                    <goal>prepare-agent</goal>
+                                </goals>
+                                <configuration>
+                                    <propertyName>jacocoAgent</propertyName>
+                                </configuration>
+                            </execution>
+                            <execution>
+                                <id>report</id>
+                                <phase>test</phase>
+                                <goals>
+                                    <goal>report</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <configuration>
+                            <argLine>${camel.surefire.fork.vmargs} 
${jacocoAgent}</argLine>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
     </profiles>
 </project>
diff --git a/pom.xml b/pom.xml
index e56146578948..be2b92bed430 100644
--- a/pom.xml
+++ b/pom.xml
@@ -312,10 +312,10 @@
                                     <exclude>**/README</exclude>
                                     <exclude>**/TestImpl*</exclude>
                                     
<exclude>**/archetype-resources/**</exclude>
-                                   <exclude>**/ca-openssl.cnf</exclude>
-                                   <exclude>**/openssl-ca.cnf</exclude>
-                                   <exclude>**/openssl-server.cnf</exclude>
-                                   <exclude>**/keystore</exclude>
+                                    <exclude>**/ca-openssl.cnf</exclude>
+                                    <exclude>**/openssl-ca.cnf</exclude>
+                                    <exclude>**/openssl-server.cnf</exclude>
+                                    <exclude>**/keystore</exclude>
                                     <exclude>**/cacerts</exclude>
                                     <exclude>**/cxf.extension</exclude>
                                     <exclude>**/dhis.conf</exclude>

Reply via email to