0

All my tests are located in src/test/java/... with java marked as a test source folder. They are also all named as ***Test so Surefire plugin should be finding them.

However my maven verify fails as all my test coverage is at 0%. I have 20 tests which should cover all of my non-excluded classes and they all pass when I do run them in my IntelliJ. When I run maven test or maven verify my tests aren't being run. I'm not sure why.

<plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.6</version>
                <executions>
                    <execution>
                        <id>default-prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-report</id>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>jacoco-check</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <excludes>
                                ...
                            </excludes>
                            <rules>
                                <rule>
                                    <element>CLASS</element>
                                    <limits>
                                        <limit>
                                            <counter>LINE</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>80%</minimum>
                                        </limit>
                                        <limit>
                                            <counter>BRANCH</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>80%</minimum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
                        </configuration>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M5</version>
            </plugin>
----------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- jacoco-maven-plugin:0.8.6:prepare-agent (default-prepare-agent) @ *-*-service ---
[INFO] surefireArgLine set to "-javaagent:C:\\Users\\*\\.m2\\repository\\org\\jacoco\\org.jacoco.agent\\0.8.6\\org.jacoco.agent-0.8.6-runtime.jar=destfile=C:\\Users\\*\\OneDrive\\Documents\\IntelliJ Projects\\*-*-service\\*-*-service\\target\\jacoco.exec,append=true"
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ *-*-service ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 1 resource
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ *-*-service ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ *-*-service ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] skip non existing resourceDirectory C:\Users\*\OneDrive\Documents\IntelliJ Projects\*-*-service\*-*-service\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ *-*-service ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ *-*-service ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[ERROR] Java HotSpot(TM) 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] 
[INFO] --- jacoco-maven-plugin:0.8.6:report (report) @ *-*-service ---
[INFO] Loading execution data file C:\Users\*\OneDrive\Documents\IntelliJ Projects\*-*-service\*-*-service\target\jacoco.exec
[INFO] Analyzed bundle '*-*-service' with 19 classes
[INFO] 
[INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) @ *-*-service ---
[INFO] 
[INFO] --- spring-boot-maven-plugin:2.4.4:repackage (repackage) @ *-*-service ---
[INFO] Replacing main artifact with repackaged archive
[INFO] 
[INFO] --- jacoco-maven-plugin:0.8.6:report (default-report) @ *-*-service ---
[INFO] Loading execution data file C:\Users\*\OneDrive\Documents\IntelliJ Projects\*-*-service\*-*-service\target\jacoco.exec
[INFO] Analyzed bundle '*-*-service' with 19 classes
[INFO] 
[INFO] --- jacoco-maven-plugin:0.8.6:check (jacoco-check) @ *-*-service ---
[INFO] Loading execution data file C:\Users\*\OneDrive\Documents\IntelliJ Projects\*-*-service\*-*-service\target\jacoco.exec
[INFO] Analyzed bundle '*-*-service' with 6 classes
[WARNING] Rule violated for class com.*.**.mapper.*Mapper: lines covered ratio is 0.00, but expected minimum is 0.80
[WARNING] Rule violated for class com.*.**.mapper.*Mapper: branches covered ratio is 0.00, but expected minimum is 0.80
[WARNING] Rule violated for class com.*.**.mapper.*Mapper: lines covered ratio is 0.00, but expected minimum is 0.80
[WARNING] Rule violated for class com.*.**.controller.*Controller: lines covered ratio is 0.00, but expected minimum is 0.80
[WARNING] Rule violated for class com.*.**.controller.*Controller: lines covered ratio is 0.00, but expected minimum is 0.80
[WARNING] Rule violated for class com.*.**.service.*Service: lines covered ratio is 0.00, but expected minimum is 0.80
[WARNING] Rule violated for class com.*.**.service.*Service: lines covered ratio is 0.00, but expected minimum is 0.80
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.388 s
[INFO] Finished at: 2021-04-11T19:48:54+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jacoco:jacoco-maven-plugin:0.8.6:check (jacoco-check) on project *-*-service: Coverage checks have not been met. See log for details. -> [Help 1]

I am using IntelliJ-IDEA ultimate version 2021.1 (Latest at post date )

Any help on getting my tests recognised in a full maven build would be greatly appreciated. Thanks

shirafuno
  • 387
  • 3
  • 9
  • 24

1 Answers1

-1

Please read the log, and check [ERROR]. You are using JDK 13 and some POM added -Xverify:none and -noverify in the configuration parameter argLine.

tibor17
  • 1,043
  • 6
  • 9