2

I am working with spring and using mvn site to check my test coverage and app dependency convergence, I am getting [Error] Error You do not have 100% convergence.

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)

I it says the issue is with versions of my slf4g in module rest-producer but i cant see any issue with my versions in this module , here it is below.

rest-producer

<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>

Can i get some suggestion of what it might be , the project has about 9 modules

The is jsonPath which i am using has a dependency

 <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.7.25</version>
      <scope>compile</scope>
 </dependency>

And dozer which i am also using has

<dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <version>${slf4j.version}</version>
      <scope>test</scope>
    </dependency>

And versions are different I think this is the proble but what can i do exclude one of them or change version of their dependency

Pedro Carneiro
  • 103
  • 1
  • 10
valik
  • 2,014
  • 4
  • 24
  • 55
  • 3
    "100% convergence". Do you mean coverage? Note that 100% coverage is almost impossible to attain, or at least leads to a point where investing time to reach 100% coverage is not worth the effort, or just leads to creating tests for the sake of improving coverage, while the test itself adds no real value in checking the correctness of your code. Metric-driven development is not the correct way of working. You should take the lack of coverage of a piece of code as a hint that you may want to add more tests if necessary, it should not be a goal in and of itself. – Mark Rotteveel Apr 28 '18 at 14:34
  • @MarkRotteveel i was talking convergence, but for tests i have 47 percent and i have actually tested everything important both integration and unit tests so i guess its ok to have 47 percent – valik Apr 28 '18 at 14:59
  • I still think you mean coverage, otherwise I don't think I understand what you mean. Exactly what do you mean with convergence? – Mark Rotteveel Apr 28 '18 at 15:08
  • so when i run mvn site and mvn site:stage and access index.html i get in dependency report - You do not have 100% convergence. because your module has one dependency with two versions there for its not ready for deployement – valik Apr 28 '18 at 15:13

1 Answers1

2

I think the error you are getting is due to having two versions of the same artifact in your dependencies. Try to exclude slf4j-api from the json-path dependency, to force your project to depend only on version 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>

You could also do the same exclusion on the dozer dependency. However, I feel it's safer to do it here, since this is dependency is only used for tests.

Pedro Carneiro
  • 103
  • 1
  • 10