Not working with org.jacoco:jacoco-maven-plugin
See original GitHub issueHi, I just updated a large project from java 11 to 17 and introduced log-captor for unit testing.
Now all my test are fine in the IDE, but when running them in the CI/CD pipeline on the server or locally with “./mvnw org.jacoco:jacoco-maven-plugin:prepare-agent test -Dmaven.test.failure=true”
I face failing tests depending on the environment these are different test. Always the log-captor seems to miss some logging.
This is how the pom looks like:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
<exclude>**/*PerformanceTest.java</exclude>
</excludes>
<classpathDependencyExcludes>
<classpathDependencyExclude>org.apache.logging.log4j:log4j-slf4j-impl</classpathDependencyExclude>
</classpathDependencyExcludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<classpathDependencyExcludes>
<classpathDependencyExclude>org.apache.logging.log4j:log4j-slf4j-impl</classpathDependencyExclude>
</classpathDependencyExcludes>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/*IntegrationTest.*</exclude>
<exclude>**/*PerformanceTest.*</exclude>
</excludes>
</configuration>
</plugin>
Any ideas what might go wrong?
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Maven JaCoCo plugin error - Stack Overflow
I faced the same problem and fixed by using below command in place of jacoco:report - mvn -X org.jacoco:jacoco-maven-plugin:report.
Read more >artifacts not resolved: org.jacoco:org.jacoco.build:jar:0.6 ...
correctly. I'm trying to implement jacoco coverage reports in a multi-project maven build and I am running into the following error when I...
Read more >Could not find artifact org.jacoco:jacoco-maven-plugin:pom ...
When trying to build the package: mvn clean package [INFO] Scanning for projects.
Read more >Untitled
4.0.0 org.jacoco org.jacoco.build 0.8.6 pom JaCoCo JaCoCo - Java Code ... GitHub https://github.com/jacoco/jacoco/issues sonatype-nexus-staging Nexus ...
Read more >Jacoco in Maven Projects - Personal Programming Notes
There are two options to fix that error. The easiest way is to specify the groupId and artifactId parameters of the plugin explicitly....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks for your help, we need the snapshot package.
I’ll try to test logging with a custom appender.
I just found out that when I used that library, json-snapshot, none of my tests got executed. I could not replicate on my side that LogCaptor was causing issues, but maybe my setup is not identical to yours.
You could also try to use https://github.com/Hakky54/console-captor which just captures the console output. In that way you don’t need a custom appender or custom logic to capture logs from a logging framework.