JaCoCo Check not failing AEM Multi-module Project build below Threshold CoverageJaCoCo not generating jacoco.exec until after skipping JaCoCo executionWhy @Ignore annotation doesn't work?How to make Maven unit test code coverage workJacoco - “Caused by: java.lang.ClassNotFoundException: org.jacoco.agent.rt.internal_6da5971.Offline”Is there a way to update default-bindings.xml for maven on localjacoco only shows coverage for classes in the same moduleJacoco.exec is not getting created for all modules in multi-module maven projectSkipping JaCoCo execution due to missing execution data file:/var/lib/jenkins/workspace/soapuiauto1/hdap-project/target/jacoco.execMaven surefire plugin is not using argLine property provided by JacocoMaven Jacoco - multi module project. What is the easiest (centralized?) setup?
Designing a magic-compatible polearm
Cut the gold chain
I just entered the USA without passport control at Atlanta airport
What does it cost to buy a tavern?
Can you use one creature for both convoke and delve for Hogaak?
What was the first third-party commercial application for MS-DOS?
Are there any individual aliens that have gained superpowers in the Marvel universe?
80s or 90s Fantasy novel, part of series. Castle talks to wizard, 2 headed dragon fights itself
Why don't countries like Japan just print more money?
Draw a symmetric alien head
Why does this compile? Returning nullptr as std::string
"Correct me if I'm wrong"
How can I prevent a user from copying files on another hard drive?
How did Gollum enter Moria?
What type of tests you should do first?
What does "determined" refer to in Acts 17v26?
"What is the maximum that Player 1 can win?"
Can the pre-order traversal of two different trees be the same even though they are different?
Mathematically modelling RC circuit with a linear input
Is "Busen" just the area between the breasts?
Should I include an appendix for inessential, yet related worldbuilding to my story?
Why isn't my calculation that we should be able to see the sun well beyond the observable universe valid?
How does join() produce different results depending on the arguments?
Is there a name for the trope when there is a moments dialogue when someone pauses just before they leave the room?
JaCoCo Check not failing AEM Multi-module Project build below Threshold Coverage
JaCoCo not generating jacoco.exec until after skipping JaCoCo executionWhy @Ignore annotation doesn't work?How to make Maven unit test code coverage workJacoco - “Caused by: java.lang.ClassNotFoundException: org.jacoco.agent.rt.internal_6da5971.Offline”Is there a way to update default-bindings.xml for maven on localjacoco only shows coverage for classes in the same moduleJacoco.exec is not getting created for all modules in multi-module maven projectSkipping JaCoCo execution due to missing execution data file:/var/lib/jenkins/workspace/soapuiauto1/hdap-project/target/jacoco.execMaven surefire plugin is not using argLine property provided by JacocoMaven Jacoco - multi module project. What is the easiest (centralized?) setup?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
- I am trying to configure jaCoCo check in my multi-module AEM 6.4 project.
- I have written Test Classes for JUnit5 Extensions which compile well.
- I can see report being published to my Sonar Server as well, coverage being 45.9% - Failed.
- When I deploy Maven project via maven Run Configurations: mvn clean verify, it always shows all modules deployed with SUCCESS.
Root POM Variables declaration:
<properties>
<!-- Sonar -->
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.jacoco.reportPaths>$project.basedir/../target/jacoco.exec</sonar.jacoco.reportPaths>
<sonar.language>java</sonar.language>
<!-- JaCoCo -->
<jacoco.percentage.instruction>0.98</jacoco.percentage.instruction>
</properties>
Root POM Maven Surefire, Fail-safe and JaCoCo Plugins Configuration
<build>
<plugins>
<!-- Maven Surefire Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<argLine>$jacocoArgLine -Xmx256m</argLine>
</configuration>
</plugin>
<!-- Maven Failsafe Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version>
</plugin>
<!-- JaCoCo Plugin for Code Coverage -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.3</version>
<configuration>
<destFile>$sonar.jacoco.reportPaths</destFile
<dataFile>$sonar.jacoco.reportPaths</dataFile>
<append>true</append>
</configuration>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>jacocoArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>check</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<dataFile>$sonar.jacoco.reportPaths</dataFile>
<rules>
<rule implementation="org.jacoco.maven.RuleConfiguration">
<element>PACKAGE</element>
<limits>
<limit implementation="org.jacoco.report.check.Limit">
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>0.80</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Please note that I did not configure any plugin on core or it.tests module POM files.
Output from logs - Core Bundle:
[INFO] Building Test - Core 0.0.1-SNAPSHOT [2/5]
[INFO] -------------------------------[ bundle ]-------------------------------
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ test.core ---
[INFO] Deleting C:AppsWorkspacegittest-bitbucketcoretarget
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven) @ test.core ---
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.3:prepare-agent (prepare-agent) @ test.core ---
[INFO] jacocoArgLine set to -javaagent:C:\Users\Public\.m2\repository\org\jacoco\org.jacoco.agent\0.8.3\org.jacoco.agent-0.8.3-runtime.jar=destfile=C:\Apps\Workspace\git\test-bitbucket\core\..\target\jacoco.exec,append=true
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ test.core ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:AppsWorkspacegittest-bitbucketcoresrcmainresources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ test.core ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 20 source files to C:AppsWorkspacegittest-bitbucketcoretargetclasses
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ test.core ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:AppsWorkspacegittest-bitbucketcoresrctestresources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ test.core ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) @ test.core ---
[INFO] No tests to run.
[INFO]
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.3:check (check) @ marketing-garage.core ---
[INFO] Skipping JaCoCo execution due to missing execution data file:C:AppsWorkspacegittest-bitbucketcore..targetjacoco.exec
Output from logs - Tests Bundle:
[INFO] Building Test - Integration 0.0.1-SNAPSHOT [5/5]
[INFO] -------------------------------[ bundle ]-------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ test.it.tests ---
[INFO] Deleting C:AppsWorkspacegittest-bitbucketit.teststarget
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven) @ test.it.tests ---
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.3:prepare-agent (prepare-agent) @ test.it.tests ---
[INFO] jacocoArgLine set to -javaagent:C:\Users\Public\.m2\repository\org\jacoco\org.jacoco.agent\0.8.3\org.jacoco.agent-0.8.3-runtime.jar=destfile=C:\Apps\Workspace\git\test-bitbucket\it.tests\..\target\jacoco.exec,append=true
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ test.it.tests ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:AppsWorkspacegittest-bitbucketit.testssrcmainresources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ test.it.tests ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ test.it.tests ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ test.it.tests ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 8 source files to C:AppsWorkspacegittest-bitbucketit.teststargettest-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) @ test.it.tests ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.test.it.tests.LogoutServletTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.603 s - in com.test.it.tests.LogoutServletTest
[INFO] Running com.test.it.tests.SocialFeedsServiceTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.731 s - in com.test.it.tests.SocialFeedsServiceTest
[INFO]
[INFO] Results:
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-bundle-plugin:4.1.0:bundle (default-bundle) @ test.it.tests -
[WARNING] Bundle com.test:test.it.tests:bundle:0.0.1-SNAPSHOT : The JAR is empty: The instructions for the JAR named com.test.it.tests did not cause any content to be included, this is likely wrong
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.3:check (check) @ test.it.tests ---
[INFO] Loading execution data file C:AppsWorkspacegittest-bitbucketit.tests..targetjacoco.exec
[INFO] Analyzed bundle 'test.it.tests' with 0 classes
[INFO] All coverage checks have been met.
[INFO] -----------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] test 0.0.1-SNAPSHOT ................ SUCCESS [ 2.091 s]
[INFO] Test - Core ........................ SUCCESS [ 15.467 s]
[INFO] Test - UI apps ..................... SUCCESS [ 55.583 s]
[INFO] Test - UI content .................. SUCCESS [ 47.815 s]
[INFO] Test - Integration 0.0.1-SNAPSHOT SUCCESS [ 36.362 s]
[INFO] -----------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] -----------------------------------------------------------------------
[INFO] Total time: 02:41 min
[INFO] Finished at: 2019-03-25T11:08:31+05:30
[INFO] -----------------------------------------------------------------------
I expected the build to fail if coverage is below 80% but this configuration is passing all builds from Maven Build perspective.
aem jacoco maven-surefire-plugin jacoco-maven-plugin aem-6
add a comment |
- I am trying to configure jaCoCo check in my multi-module AEM 6.4 project.
- I have written Test Classes for JUnit5 Extensions which compile well.
- I can see report being published to my Sonar Server as well, coverage being 45.9% - Failed.
- When I deploy Maven project via maven Run Configurations: mvn clean verify, it always shows all modules deployed with SUCCESS.
Root POM Variables declaration:
<properties>
<!-- Sonar -->
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.jacoco.reportPaths>$project.basedir/../target/jacoco.exec</sonar.jacoco.reportPaths>
<sonar.language>java</sonar.language>
<!-- JaCoCo -->
<jacoco.percentage.instruction>0.98</jacoco.percentage.instruction>
</properties>
Root POM Maven Surefire, Fail-safe and JaCoCo Plugins Configuration
<build>
<plugins>
<!-- Maven Surefire Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<argLine>$jacocoArgLine -Xmx256m</argLine>
</configuration>
</plugin>
<!-- Maven Failsafe Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version>
</plugin>
<!-- JaCoCo Plugin for Code Coverage -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.3</version>
<configuration>
<destFile>$sonar.jacoco.reportPaths</destFile
<dataFile>$sonar.jacoco.reportPaths</dataFile>
<append>true</append>
</configuration>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>jacocoArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>check</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<dataFile>$sonar.jacoco.reportPaths</dataFile>
<rules>
<rule implementation="org.jacoco.maven.RuleConfiguration">
<element>PACKAGE</element>
<limits>
<limit implementation="org.jacoco.report.check.Limit">
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>0.80</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Please note that I did not configure any plugin on core or it.tests module POM files.
Output from logs - Core Bundle:
[INFO] Building Test - Core 0.0.1-SNAPSHOT [2/5]
[INFO] -------------------------------[ bundle ]-------------------------------
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ test.core ---
[INFO] Deleting C:AppsWorkspacegittest-bitbucketcoretarget
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven) @ test.core ---
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.3:prepare-agent (prepare-agent) @ test.core ---
[INFO] jacocoArgLine set to -javaagent:C:\Users\Public\.m2\repository\org\jacoco\org.jacoco.agent\0.8.3\org.jacoco.agent-0.8.3-runtime.jar=destfile=C:\Apps\Workspace\git\test-bitbucket\core\..\target\jacoco.exec,append=true
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ test.core ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:AppsWorkspacegittest-bitbucketcoresrcmainresources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ test.core ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 20 source files to C:AppsWorkspacegittest-bitbucketcoretargetclasses
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ test.core ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:AppsWorkspacegittest-bitbucketcoresrctestresources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ test.core ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) @ test.core ---
[INFO] No tests to run.
[INFO]
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.3:check (check) @ marketing-garage.core ---
[INFO] Skipping JaCoCo execution due to missing execution data file:C:AppsWorkspacegittest-bitbucketcore..targetjacoco.exec
Output from logs - Tests Bundle:
[INFO] Building Test - Integration 0.0.1-SNAPSHOT [5/5]
[INFO] -------------------------------[ bundle ]-------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ test.it.tests ---
[INFO] Deleting C:AppsWorkspacegittest-bitbucketit.teststarget
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven) @ test.it.tests ---
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.3:prepare-agent (prepare-agent) @ test.it.tests ---
[INFO] jacocoArgLine set to -javaagent:C:\Users\Public\.m2\repository\org\jacoco\org.jacoco.agent\0.8.3\org.jacoco.agent-0.8.3-runtime.jar=destfile=C:\Apps\Workspace\git\test-bitbucket\it.tests\..\target\jacoco.exec,append=true
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ test.it.tests ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:AppsWorkspacegittest-bitbucketit.testssrcmainresources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ test.it.tests ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ test.it.tests ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ test.it.tests ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 8 source files to C:AppsWorkspacegittest-bitbucketit.teststargettest-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) @ test.it.tests ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.test.it.tests.LogoutServletTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.603 s - in com.test.it.tests.LogoutServletTest
[INFO] Running com.test.it.tests.SocialFeedsServiceTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.731 s - in com.test.it.tests.SocialFeedsServiceTest
[INFO]
[INFO] Results:
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-bundle-plugin:4.1.0:bundle (default-bundle) @ test.it.tests -
[WARNING] Bundle com.test:test.it.tests:bundle:0.0.1-SNAPSHOT : The JAR is empty: The instructions for the JAR named com.test.it.tests did not cause any content to be included, this is likely wrong
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.3:check (check) @ test.it.tests ---
[INFO] Loading execution data file C:AppsWorkspacegittest-bitbucketit.tests..targetjacoco.exec
[INFO] Analyzed bundle 'test.it.tests' with 0 classes
[INFO] All coverage checks have been met.
[INFO] -----------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] test 0.0.1-SNAPSHOT ................ SUCCESS [ 2.091 s]
[INFO] Test - Core ........................ SUCCESS [ 15.467 s]
[INFO] Test - UI apps ..................... SUCCESS [ 55.583 s]
[INFO] Test - UI content .................. SUCCESS [ 47.815 s]
[INFO] Test - Integration 0.0.1-SNAPSHOT SUCCESS [ 36.362 s]
[INFO] -----------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] -----------------------------------------------------------------------
[INFO] Total time: 02:41 min
[INFO] Finished at: 2019-03-25T11:08:31+05:30
[INFO] -----------------------------------------------------------------------
I expected the build to fail if coverage is below 80% but this configuration is passing all builds from Maven Build perspective.
aem jacoco maven-surefire-plugin jacoco-maven-plugin aem-6
Did you find the solution?
– ronnyfm
Apr 12 at 22:56
add a comment |
- I am trying to configure jaCoCo check in my multi-module AEM 6.4 project.
- I have written Test Classes for JUnit5 Extensions which compile well.
- I can see report being published to my Sonar Server as well, coverage being 45.9% - Failed.
- When I deploy Maven project via maven Run Configurations: mvn clean verify, it always shows all modules deployed with SUCCESS.
Root POM Variables declaration:
<properties>
<!-- Sonar -->
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.jacoco.reportPaths>$project.basedir/../target/jacoco.exec</sonar.jacoco.reportPaths>
<sonar.language>java</sonar.language>
<!-- JaCoCo -->
<jacoco.percentage.instruction>0.98</jacoco.percentage.instruction>
</properties>
Root POM Maven Surefire, Fail-safe and JaCoCo Plugins Configuration
<build>
<plugins>
<!-- Maven Surefire Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<argLine>$jacocoArgLine -Xmx256m</argLine>
</configuration>
</plugin>
<!-- Maven Failsafe Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version>
</plugin>
<!-- JaCoCo Plugin for Code Coverage -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.3</version>
<configuration>
<destFile>$sonar.jacoco.reportPaths</destFile
<dataFile>$sonar.jacoco.reportPaths</dataFile>
<append>true</append>
</configuration>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>jacocoArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>check</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<dataFile>$sonar.jacoco.reportPaths</dataFile>
<rules>
<rule implementation="org.jacoco.maven.RuleConfiguration">
<element>PACKAGE</element>
<limits>
<limit implementation="org.jacoco.report.check.Limit">
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>0.80</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Please note that I did not configure any plugin on core or it.tests module POM files.
Output from logs - Core Bundle:
[INFO] Building Test - Core 0.0.1-SNAPSHOT [2/5]
[INFO] -------------------------------[ bundle ]-------------------------------
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ test.core ---
[INFO] Deleting C:AppsWorkspacegittest-bitbucketcoretarget
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven) @ test.core ---
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.3:prepare-agent (prepare-agent) @ test.core ---
[INFO] jacocoArgLine set to -javaagent:C:\Users\Public\.m2\repository\org\jacoco\org.jacoco.agent\0.8.3\org.jacoco.agent-0.8.3-runtime.jar=destfile=C:\Apps\Workspace\git\test-bitbucket\core\..\target\jacoco.exec,append=true
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ test.core ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:AppsWorkspacegittest-bitbucketcoresrcmainresources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ test.core ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 20 source files to C:AppsWorkspacegittest-bitbucketcoretargetclasses
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ test.core ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:AppsWorkspacegittest-bitbucketcoresrctestresources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ test.core ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) @ test.core ---
[INFO] No tests to run.
[INFO]
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.3:check (check) @ marketing-garage.core ---
[INFO] Skipping JaCoCo execution due to missing execution data file:C:AppsWorkspacegittest-bitbucketcore..targetjacoco.exec
Output from logs - Tests Bundle:
[INFO] Building Test - Integration 0.0.1-SNAPSHOT [5/5]
[INFO] -------------------------------[ bundle ]-------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ test.it.tests ---
[INFO] Deleting C:AppsWorkspacegittest-bitbucketit.teststarget
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven) @ test.it.tests ---
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.3:prepare-agent (prepare-agent) @ test.it.tests ---
[INFO] jacocoArgLine set to -javaagent:C:\Users\Public\.m2\repository\org\jacoco\org.jacoco.agent\0.8.3\org.jacoco.agent-0.8.3-runtime.jar=destfile=C:\Apps\Workspace\git\test-bitbucket\it.tests\..\target\jacoco.exec,append=true
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ test.it.tests ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:AppsWorkspacegittest-bitbucketit.testssrcmainresources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ test.it.tests ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ test.it.tests ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ test.it.tests ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 8 source files to C:AppsWorkspacegittest-bitbucketit.teststargettest-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) @ test.it.tests ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.test.it.tests.LogoutServletTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.603 s - in com.test.it.tests.LogoutServletTest
[INFO] Running com.test.it.tests.SocialFeedsServiceTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.731 s - in com.test.it.tests.SocialFeedsServiceTest
[INFO]
[INFO] Results:
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-bundle-plugin:4.1.0:bundle (default-bundle) @ test.it.tests -
[WARNING] Bundle com.test:test.it.tests:bundle:0.0.1-SNAPSHOT : The JAR is empty: The instructions for the JAR named com.test.it.tests did not cause any content to be included, this is likely wrong
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.3:check (check) @ test.it.tests ---
[INFO] Loading execution data file C:AppsWorkspacegittest-bitbucketit.tests..targetjacoco.exec
[INFO] Analyzed bundle 'test.it.tests' with 0 classes
[INFO] All coverage checks have been met.
[INFO] -----------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] test 0.0.1-SNAPSHOT ................ SUCCESS [ 2.091 s]
[INFO] Test - Core ........................ SUCCESS [ 15.467 s]
[INFO] Test - UI apps ..................... SUCCESS [ 55.583 s]
[INFO] Test - UI content .................. SUCCESS [ 47.815 s]
[INFO] Test - Integration 0.0.1-SNAPSHOT SUCCESS [ 36.362 s]
[INFO] -----------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] -----------------------------------------------------------------------
[INFO] Total time: 02:41 min
[INFO] Finished at: 2019-03-25T11:08:31+05:30
[INFO] -----------------------------------------------------------------------
I expected the build to fail if coverage is below 80% but this configuration is passing all builds from Maven Build perspective.
aem jacoco maven-surefire-plugin jacoco-maven-plugin aem-6
- I am trying to configure jaCoCo check in my multi-module AEM 6.4 project.
- I have written Test Classes for JUnit5 Extensions which compile well.
- I can see report being published to my Sonar Server as well, coverage being 45.9% - Failed.
- When I deploy Maven project via maven Run Configurations: mvn clean verify, it always shows all modules deployed with SUCCESS.
Root POM Variables declaration:
<properties>
<!-- Sonar -->
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.jacoco.reportPaths>$project.basedir/../target/jacoco.exec</sonar.jacoco.reportPaths>
<sonar.language>java</sonar.language>
<!-- JaCoCo -->
<jacoco.percentage.instruction>0.98</jacoco.percentage.instruction>
</properties>
Root POM Maven Surefire, Fail-safe and JaCoCo Plugins Configuration
<build>
<plugins>
<!-- Maven Surefire Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<argLine>$jacocoArgLine -Xmx256m</argLine>
</configuration>
</plugin>
<!-- Maven Failsafe Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version>
</plugin>
<!-- JaCoCo Plugin for Code Coverage -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.3</version>
<configuration>
<destFile>$sonar.jacoco.reportPaths</destFile
<dataFile>$sonar.jacoco.reportPaths</dataFile>
<append>true</append>
</configuration>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>jacocoArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>check</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<dataFile>$sonar.jacoco.reportPaths</dataFile>
<rules>
<rule implementation="org.jacoco.maven.RuleConfiguration">
<element>PACKAGE</element>
<limits>
<limit implementation="org.jacoco.report.check.Limit">
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>0.80</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Please note that I did not configure any plugin on core or it.tests module POM files.
Output from logs - Core Bundle:
[INFO] Building Test - Core 0.0.1-SNAPSHOT [2/5]
[INFO] -------------------------------[ bundle ]-------------------------------
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ test.core ---
[INFO] Deleting C:AppsWorkspacegittest-bitbucketcoretarget
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven) @ test.core ---
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.3:prepare-agent (prepare-agent) @ test.core ---
[INFO] jacocoArgLine set to -javaagent:C:\Users\Public\.m2\repository\org\jacoco\org.jacoco.agent\0.8.3\org.jacoco.agent-0.8.3-runtime.jar=destfile=C:\Apps\Workspace\git\test-bitbucket\core\..\target\jacoco.exec,append=true
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ test.core ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:AppsWorkspacegittest-bitbucketcoresrcmainresources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ test.core ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 20 source files to C:AppsWorkspacegittest-bitbucketcoretargetclasses
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ test.core ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:AppsWorkspacegittest-bitbucketcoresrctestresources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ test.core ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) @ test.core ---
[INFO] No tests to run.
[INFO]
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.3:check (check) @ marketing-garage.core ---
[INFO] Skipping JaCoCo execution due to missing execution data file:C:AppsWorkspacegittest-bitbucketcore..targetjacoco.exec
Output from logs - Tests Bundle:
[INFO] Building Test - Integration 0.0.1-SNAPSHOT [5/5]
[INFO] -------------------------------[ bundle ]-------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ test.it.tests ---
[INFO] Deleting C:AppsWorkspacegittest-bitbucketit.teststarget
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven) @ test.it.tests ---
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.3:prepare-agent (prepare-agent) @ test.it.tests ---
[INFO] jacocoArgLine set to -javaagent:C:\Users\Public\.m2\repository\org\jacoco\org.jacoco.agent\0.8.3\org.jacoco.agent-0.8.3-runtime.jar=destfile=C:\Apps\Workspace\git\test-bitbucket\it.tests\..\target\jacoco.exec,append=true
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ test.it.tests ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:AppsWorkspacegittest-bitbucketit.testssrcmainresources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ test.it.tests ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ test.it.tests ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ test.it.tests ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 8 source files to C:AppsWorkspacegittest-bitbucketit.teststargettest-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) @ test.it.tests ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.test.it.tests.LogoutServletTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.603 s - in com.test.it.tests.LogoutServletTest
[INFO] Running com.test.it.tests.SocialFeedsServiceTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.731 s - in com.test.it.tests.SocialFeedsServiceTest
[INFO]
[INFO] Results:
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-bundle-plugin:4.1.0:bundle (default-bundle) @ test.it.tests -
[WARNING] Bundle com.test:test.it.tests:bundle:0.0.1-SNAPSHOT : The JAR is empty: The instructions for the JAR named com.test.it.tests did not cause any content to be included, this is likely wrong
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.3:check (check) @ test.it.tests ---
[INFO] Loading execution data file C:AppsWorkspacegittest-bitbucketit.tests..targetjacoco.exec
[INFO] Analyzed bundle 'test.it.tests' with 0 classes
[INFO] All coverage checks have been met.
[INFO] -----------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] test 0.0.1-SNAPSHOT ................ SUCCESS [ 2.091 s]
[INFO] Test - Core ........................ SUCCESS [ 15.467 s]
[INFO] Test - UI apps ..................... SUCCESS [ 55.583 s]
[INFO] Test - UI content .................. SUCCESS [ 47.815 s]
[INFO] Test - Integration 0.0.1-SNAPSHOT SUCCESS [ 36.362 s]
[INFO] -----------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] -----------------------------------------------------------------------
[INFO] Total time: 02:41 min
[INFO] Finished at: 2019-03-25T11:08:31+05:30
[INFO] -----------------------------------------------------------------------
I expected the build to fail if coverage is below 80% but this configuration is passing all builds from Maven Build perspective.
aem jacoco maven-surefire-plugin jacoco-maven-plugin aem-6
aem jacoco maven-surefire-plugin jacoco-maven-plugin aem-6
edited Mar 25 at 7:06
barbsan
2,71981524
2,71981524
asked Mar 25 at 7:01
Som MookerjeeSom Mookerjee
111
111
Did you find the solution?
– ronnyfm
Apr 12 at 22:56
add a comment |
Did you find the solution?
– ronnyfm
Apr 12 at 22:56
Did you find the solution?
– ronnyfm
Apr 12 at 22:56
Did you find the solution?
– ronnyfm
Apr 12 at 22:56
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55332650%2fjacoco-check-not-failing-aem-multi-module-project-build-below-threshold-coverage%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55332650%2fjacoco-check-not-failing-aem-multi-module-project-build-below-threshold-coverage%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Did you find the solution?
– ronnyfm
Apr 12 at 22:56