diff-coverage-maven-plugin
diff-coverage-maven-plugin copied to clipboard
use the same block diff-coverage-maven-plugin as given in document but get the error
Describe the Issue
- we use the same block diff-coverage-maven-plugin as given in document but get the error
Desktop (complete the following information):
- OS: [Windows 11]
- maven version: [3.0.2, 3.2.5]
- diff-coverage-maven-plugin [0.3.3]
- Java version - 1.8.0
Configuration Of pom.xml
Below I mentioned the configuration of pom.xml.
<plugin>
<groupId>com.github.surpsg</groupId>
<artifactId>diff-coverage-maven-plugin</artifactId>
<version>0.3.0</version>
<configuration>
<!-- Required. diff content source. only one of file, URL or Git is allowed -->
<diffSource>
<!-- path to diff file -->
<git>refs/remotes/origin/QA</git> <!-- compares current HEAD and all uncommited with this <git> -->
</diffSource>
<dataFileIncludes>**/AViewerService/target/*.exec</dataFileIncludes>
<!-- Optional -->
<violations>
<!-- Default 'false'. Fail build if violation rules weren't met -->
<failOnViolation>true</failOnViolation>
<minLines>0.8</minLines>
</violations>
<!-- Optional. Ant patterns by which we include classes for coverage report. -->
<!-- Optional. Ant patterns by which we exclude classes from coverage report. -->
<!-- <excludes>
<exclude>**/exclude/**/ClassName.class</exclude>
</excludes> -->
<!-- If neither <includes> nor <excludes> are specified then we pass all classes for coverage report -->
</configuration>
<executions>
<execution>
<goals>
<goal>diffCoverage</goal>
</goals>
</execution>
</executions>
</plugin>
Executable Command
mvn clean test diff-coverage:diffCoverage
Errors
It throws an error like this -
Execution default-cli of goal com.github.surpsg:diff-coverage-maven-plugin:0.3.0:diffCoverage failed: An API incompatibility was encountered while executing com.github.surpsg:diff-coverage-maven-plugin:0.3.0:diffCoverage: java.lang.UnsupportedClassVersionError: org/eclipse/jgit/storage/file/FileRepositoryBuilder has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
Expected behavior
- It should compute code coverage of new/modified code based on a provided diff
Hi @shubhampanchal21109 Seems, you are old java 8.
Diff coverage uses jgit library for generating patch file. Seems, the was compiled with target java version 11.
If you have to use java 8 then you can generate patch file and provide it to diff coverage plugin. So you will avoid jgit invocation, so you will be able using the diff coverage plugin