未能获得 100% 的覆盖率
Failing to get 100% coverage
我正在使用 spring 并使用 mvn 站点检查我的测试覆盖率和应用依赖性收敛,我收到 [错误] 错误你没有 100% 收敛。
Dependencies used in modules
org.slf4j:slf4j-api
1.7.25
com.epam.brest.course:rest-producer:war:1.0-SNAPSHOT
\- com.jayway.jsonpath:json-path:jar:2.3.0:test
\- (org.slf4j:slf4j-api:jar:1.7.25:test - omitted for conflict with 1.7.5)
1.7.5
com.epam.brest.course:rest-producer:war:1.0-SNAPSHOT
\- net.sf.dozer:dozer:jar:5.5.1:compile
+- org.slf4j:slf4j-api:jar:1.7.5:compile
\- org.slf4j:jcl-over-slf4j:jar:1.7.5:compile
\- (org.slf4j:slf4j-api:jar:1.7.5:compile - omitted for duplicate)
我说问题出在模块 rest-producer 中的 slf4g 版本
但是我在这个模块中看不到我的版本有任何问题,在下面。
休息生产者
<dependency>
<groupId>com.epam.brest.course</groupId>
<artifactId>service</artifactId>
</dependency>
<dependency>
<groupId>net.sf.dozer</groupId>
<artifactId>dozer-spring</artifactId>
</dependency>
<dependency>
<groupId>net.sf.dozer</groupId>
<artifactId>dozer</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jcl</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.epam.brest.course</groupId>
<artifactId>utility</artifactId>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
</dependency>
and my parent module has such versions
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<h2.version>1.4.196</h2.version>
<spring.version>4.3.14.RELEASE</spring.version>
<log4j2.version>2.10.0</log4j2.version>
<thymeleaf-spring4.version>3.0.8.RELEASE</thymeleaf-spring4.version>
<project.version>1.0-SNAPSHOT</project.version>
<servlet.version>3.0.1</servlet.version>
<jackson.databind-version>2.9.4</jackson.databind-version>
<validation.version>1.1.0.Final</validation.version>
<hamcrest.version>1.3</hamcrest.version>
<jsonpath.version>2.3.0</jsonpath.version>
<junit.version>4.12</junit.version>
<hibernate.version>5.1.3.Final</hibernate.version>
<dozer.version>5.5.1</dozer.version>
<Mocktio.version>1.9.5</Mocktio.version>
</properties>
我能得到一些关于它可能是什么的建议吗,该项目有大约 9 个模块
我正在使用的 is jsonPath 具有依赖性
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
<scope>compile</scope>
</dependency>
我也在用的推土机
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
<scope>test</scope>
</dependency>
而且版本不同我认为这是问题所在但我能做些什么来排除其中一个或更改其依赖项的版本
我认为您遇到的错误是由于您的依赖项中存在同一工件的两个版本。尝试从 json-path
依赖项中排除 slf4j-api
,以强制您的项目仅依赖于版本 1.7.5
:
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
您也可以对 dozer
依赖项执行相同的排除。但是,我觉得在这里做更安全,因为这个依赖只用于测试。
我正在使用 spring 并使用 mvn 站点检查我的测试覆盖率和应用依赖性收敛,我收到 [错误] 错误你没有 100% 收敛。
Dependencies used in modules
org.slf4j:slf4j-api
1.7.25
com.epam.brest.course:rest-producer:war:1.0-SNAPSHOT
\- com.jayway.jsonpath:json-path:jar:2.3.0:test
\- (org.slf4j:slf4j-api:jar:1.7.25:test - omitted for conflict with 1.7.5)
1.7.5
com.epam.brest.course:rest-producer:war:1.0-SNAPSHOT
\- net.sf.dozer:dozer:jar:5.5.1:compile
+- org.slf4j:slf4j-api:jar:1.7.5:compile
\- org.slf4j:jcl-over-slf4j:jar:1.7.5:compile
\- (org.slf4j:slf4j-api:jar:1.7.5:compile - omitted for duplicate)
我说问题出在模块 rest-producer 中的 slf4g 版本 但是我在这个模块中看不到我的版本有任何问题,在下面。
休息生产者
<dependency>
<groupId>com.epam.brest.course</groupId>
<artifactId>service</artifactId>
</dependency>
<dependency>
<groupId>net.sf.dozer</groupId>
<artifactId>dozer-spring</artifactId>
</dependency>
<dependency>
<groupId>net.sf.dozer</groupId>
<artifactId>dozer</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jcl</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.epam.brest.course</groupId>
<artifactId>utility</artifactId>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
</dependency>
and my parent module has such versions
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<h2.version>1.4.196</h2.version>
<spring.version>4.3.14.RELEASE</spring.version>
<log4j2.version>2.10.0</log4j2.version>
<thymeleaf-spring4.version>3.0.8.RELEASE</thymeleaf-spring4.version>
<project.version>1.0-SNAPSHOT</project.version>
<servlet.version>3.0.1</servlet.version>
<jackson.databind-version>2.9.4</jackson.databind-version>
<validation.version>1.1.0.Final</validation.version>
<hamcrest.version>1.3</hamcrest.version>
<jsonpath.version>2.3.0</jsonpath.version>
<junit.version>4.12</junit.version>
<hibernate.version>5.1.3.Final</hibernate.version>
<dozer.version>5.5.1</dozer.version>
<Mocktio.version>1.9.5</Mocktio.version>
</properties>
我能得到一些关于它可能是什么的建议吗,该项目有大约 9 个模块
我正在使用的 is jsonPath 具有依赖性
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
<scope>compile</scope>
</dependency>
我也在用的推土机
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
<scope>test</scope>
</dependency>
而且版本不同我认为这是问题所在但我能做些什么来排除其中一个或更改其依赖项的版本
我认为您遇到的错误是由于您的依赖项中存在同一工件的两个版本。尝试从 json-path
依赖项中排除 slf4j-api
,以强制您的项目仅依赖于版本 1.7.5
:
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
您也可以对 dozer
依赖项执行相同的排除。但是,我觉得在这里做更安全,因为这个依赖只用于测试。